Log in

View Full Version : htaccess 404



Deadweight
09-25-2014, 08:45 PM
Currently I made a php file that redirects to the home page; then i made a .htaccess page that if its a 404 error code it's suppose to load the new page using this...


ErrorDocument 404 404.php


However it doesnt redirect. It just says 404.php

jscheuer1
09-25-2014, 10:07 PM
Is the path correct? Also, you may need to quote 404.php and/or terminate the line somehow (semi-colon I would guess). A preceding / slash may be needed. These files can be very tricky as far as the syntax goes, varying on different servers even. That is to say there could be other syntax issue(s) and those I mentioned might not apply.

See also:

http://www.javascriptkit.com/howto/htaccess2.shtml

Deadweight
09-25-2014, 10:14 PM
Yeah i did try all that
"/404.php"
/404.php
and "404.php"
Nothing works still (Im running it from localhost.)

jscheuer1
09-25-2014, 10:34 PM
I just tried on my localhost and this works to get to a 404.php that is in its domain root:


ErrorDocument 404 /404.php

Note: it's the only thing in the .htaccess file and that file is also in the domain root. Redirection (using header location) from the 404.php then works as expected.