How to get both redirection & 404 errors working using htaccess?

RealNames

Verified User
Joined
Feb 22, 2004
Messages
50
Anyone know how to setup BOTH 404 error code htaccess and also an htaccess for redirect/forwarding?

It seems like I can only do one or the other, since the files both need to be named the same htaccess. I also tried combining both the error code and the redirect lines in one file but it did not work.

If that can not be done using htaccess, is there perhaps a different way to do so? Thanks.
 
just put both lines in the 1 .htaccess

Code:
Redirect /file.htm [url]http://yoursite.com/[/url]
ErrorDocument 404 /errors/404.htm
ErrorDocument 500 /errors/500.htm

Chris
 
Originally posted by ProWebUK just put both lines in the 1 .htaccess
Code:
Redirect /file.htm [url]http://yoursite.com/[/url]
ErrorDocument 404 /errors/404.htm
ErrorDocument 500 /errors/500.htm

Thanks but it does not work! As I said, already tried combining the code in the past and always failed. The redirect works but not the error codes.

If your go to www.redirname.com the redirect to domainname.com works. But if you go to www.redirname.com/test.htm it fails to redirect to the domainname index page as I want it to do, instead giving the 404 page not found error.

As a test, also tried putting the redirect line last (not sure if that would make a difference or not), and that did not help. Here is my code:

Redirect / http://www.domainname.com/
ErrorDocument 404 http://www.domaindame.com
ErrorDocument 400 http://www.domainname.com
ErrorDocument 500 http://www.domainname.com
 
Back
Top