mlessar Posted June 15, 2003 Posted June 15, 2003 I'm trying to setup my .htaccess file to use custom error documents. The problem is that if I put: ErrorDocument 403 *****/403.html it works fine, but ErrorDocument 403 /403.html does not work... Why? Thanks Quote
KevinW Posted June 15, 2003 Posted June 15, 2003 Just a guess .. but I would suspect the reason it does not work is that /403.html is saying to go to your root directory to find the file 403.html -- but obviously it is not finding the '403.html' file there. Remember that your web site is actually located at: /home/{username}/public_html This is is usually referred to as your document root. So, if you really want to reference your error file as /403.html -- you're going to have to move it up to your /home directory -- or change your .htaccess file to read: ErrorDocument 403 /home/{username}/public_html/403.html Does that make any sense? kw Quote
Twisted Posted June 15, 2003 Posted June 15, 2003 also shouldn't the 404 page be 404.shtml instead of 404.html or am i thinking of the normal 404 custom error pages? Quote
idallen Posted June 15, 2003 Posted June 15, 2003 If you look in the error log for your site you'll find the actual pathname that wasn't found. (In your cPanel, look under Stats.) That will tell you where to put the error document. For example: [sun Jun 15 01:50:47 2003] [error] [client 203.203.132.234] File does not exist: /home/something/public_html/404.shtml You may also have to check the server-wide error log at /usr/local/apache/logs/error_log : [sun Jun 15 01:49:49 2003] [error] [client 66.11.162.123] File does not exist: /usr/local/apache/htdocs/404.shtml I found that this path worked for a file located in /home/idallen/public_html/404.txt : ErrorDocument 404 /~idallen/404.txt Quote
KevinW Posted June 15, 2003 Posted June 15, 2003 Ian, thanks for the tip on checking the log files. Not sure I would ahve thought of that one. -kw Quote
KevinW Posted June 15, 2003 Posted June 15, 2003 P.S. -- I've re-edited Ian's comments slightly and posted it to the TCH Help site -- click here. If someone has further info or corrections to this topic, please let us know! -kw Quote
mlessar Posted June 15, 2003 Author Posted June 15, 2003 Strangely, /home/something/public_html/404.html did not work (i had already tried that one), but /~username/404.html does.. I don't get it but at least it works now! Thanks Quote
KevinW Posted June 16, 2003 Posted June 16, 2003 Yes, stranger - but glad to hear it's working! -kw Quote
idallen Posted June 16, 2003 Posted June 16, 2003 Strangely, /home/something/public_html/404.html did not work (i had already tried that one), but /~username/404.html does.. I don't get it but at least it works now! Thanks The ErrorDocument is a URL, it's not a Unix pathname. /~user/file is a URL that becomes /home/user/public_html/file when the web server fetches it. /home/user/file is a URL that becomes /usr/local/apache/htdocs/home/user/file (a pathname based in the root of the web server). You can specify any URL, even a URL on another machine... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.