PDA

View Full Version : htaccess path errors



reagan83
09-01-2006, 11:43 PM
I'm trying to setup a 404 redirect page, but I can't figure the path to get it working.

ErrorDocument 404 /error.php (doesn't work)
ErrorDocument 404 ~/www/error.php (doesn't work)
ErrorDocument 404 /home/justrhym/public_html/error.php (doesn't work)

The only thing that does work is if I give it an absolute path:

ErrorDocument 404 http://70.103.16.150/~justrhym/error.php

Has anyone else experienced this problem or know of a solution?

Basil
09-02-2006, 10:36 AM
Why don't you use the error pages link in cpanel?

dvessel
09-02-2006, 02:28 PM
ErrorDocument 404 /error.php (doesn't work)
ErrorDocument 404 ~/www/error.php (doesn't work)
ErrorDocument 404 /home/justrhym/public_html/error.php (doesn't work)


The last two are internal paths which don't work with 404s'. -I don't think it does anyway.. The first points to the base path for the domain which should work if the file exists.



The only thing that does work is if I give it an absolute path:

ErrorDocument 404 http://70.103.16.150/~justrhym/error.php


Pop-quiz.. What's the base path (or root level ) of the address above? . . . . .

It's the first "/" after the numbers. Not "~justrhym/" so you see why your first example doesn't work?

If you accessed the page with a named domain (not IP) then the first should work since the "~justrhym/" wouldn't be used.

Basil
09-02-2006, 02:44 PM
I just noticed that the error pages thing in cpanel doesn't actually work if you try to save it as anything but 404.shtml, so you could try using this in the htaccess file..

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^404.shtml$ error.php

edit:
Unfortunately, since explorer is retarded, you'll have to make a 404.shtml that is more than 512 bytes to keep IE from hijacking your error page.