0

I get 404 errs with tangling urls such as www.mysite.com/XYZ_404err_variety, I want to redirect everything like that to www.mysite.com/, how? I am using *ix -server on apahce. I tried this one but it messed up my configurations for some reason:

RewriteEngine On
RewriteBase /
redirect 404 ^(.*)$ www\.mysite\.com$1 [R]

and this one:

RewriteEngine On
RewriteBase /
redirect 404 ^(www\.mysite\.com*)$ www\.mysite\.com$1 [R]

1 Answers1

0

The status flag on Redirect alters the status code returned with the redirect, as opposed to handling the error pages for specific status codes.

It sounds like instead of that, you're looking to send 404-responded requests to your root page:

ErrorDocument 404 http://example.com/
Shane Madden
  • 112,982
  • 12
  • 174
  • 248
  • Yes that is totally right! It worked. I cannot understand the sentence `"The status flag on Redirect alters the status code returned with the redirect, as opposed to handling the error pages for specific status codes."`, can you clarify? The `"redirect 404 ..."` can change 404 status code to ABC status-code?! The thing `"ErrorDocument 404 ..."` is simple redirection from the status-code to the url?! –  Feb 17 '12 at 21:28
  • Basically, what that does is allows your redirect action to specify the response code that it uses - so you can pick `301` for permanent, `302` for "found", etc. It's setting a status code for a response that it's already handling, whereas `ErrorDocument` is being used in *reaction* to a status code being generated elsewhere. Does that make sense? – Shane Madden Feb 17 '12 at 21:31
  • Do you mean: `"ErrorDocument 404 302"` is valid but `"Redirect 404 302"` makes no sense? Sorry I need to make more work to understand your writing, could you offer some good reference material? Some man -page in *ix -machine about this topic? –  Feb 17 '12 at 21:33
  • 1
    Actually neither of those work - `ErrorDocument` must react to an error code with a different document (not a different error code), which `Redirect` must do a valid redirect (but can tack a status code modification in there if desired). – Shane Madden Feb 17 '12 at 21:35