View Full Version : "ErrorDocument" in .htaccess - How To?
Don Wallace
06-02-1999, 12:22 AM
Hi,
I am trying to use an Error Document in an .htaccess file. It doesn't work.[nbsp][nbsp]Everything related to password protection works as I need it. I am just trying for a slightly more professional look by customizing the error 401 behavior.
What I get is the standard 401 page with a subtext "in addition there was a 404 error when accessing the ErrorDocument file" or somesuch.
Here is what my .htaccess file looks like... (please ignore linewrapping on AuthName line, it is not wrapped in real life.)
ErrorDocument 401 /big/dom/xdonwallace/cantpost.html
AuthUserFile (bla bla)
AuthName "IT Small Business BBS - User Name and Password Required to post"
AuthType Basic
require valid-user
Any ideas or suggestions? I have tried putting the cantpost.html file in the www and the cgi-bin folders to no avail.
Thanks,
Don
Terra
06-02-1999, 12:33 AM
Did you change:
/big/dom/xdonwallace/cantpost.html
to:
/big/dom/xdonwallace/www/cantpost.html
and put the html file in your www tree?
--
Terra
sysAdmin
FutureQuest
Terra
06-09-1999, 01:44 PM
I just looked at your logs_web/error log and think this will solve it...
The ErrorDocument is already rooted to your DocumentRoot so change to the following:
ErrorDocument 401 /cantpost.html
This will probably fix the issue as Apache prepends the '/big/dom/xdonwallace/www'...[nbsp][nbsp]I felt that using the full path would have overridden the DocumentRoot prepend but Apache has now shown me otherwise...
--
Terra
--so many rules, so little time--
FutureQuest
Don Wallace
06-09-1999, 11:46 PM
Ahhh yes, that did it! That was the problem, now it works. Thanks, I appreciate it.
This might be a nice bit of info to add to your FAQs on .htaccess.
Don Wallace
06-10-1999, 12:47 AM
Hi Terra -
Thanks for replying. Yes, I have done all that, and I get a 404 (not found) error in the standard Apache 401 screen that comes back.
Here is what I now have for .htaccess which still doesn't work. If you try surfing www.donwallace.com/cgi-bin/bbs/wwwboard.pl you will get the password screen and can can cancel out to see that the HTML for error 401 does not work.
ErrorDocument 401 /big/dom/xdonwallace/www/cantpost.html
AuthUserFile (blah)
AuthName "IT Small Business BBS - User Name and Password Required to post"
AuthType Basic
require valid-user
And you can surf www.donwallace.com/cantpost.html to see that indeed the file is accessible for browsing.
- Don<!-- NO_AUTO_LINK -->
Justin
06-10-1999, 02:05 AM
Here is a basic .htaccess file for a 404 page:
[nbsp][nbsp] ErrorDocument 404 /404.html
Simply put, if the server cannot find a page that the user requested, the user is directed to the Error Document, in this case a file called 404.html in the <font color=#FF0000>root directory</font>. You can also specify a document in another directory:
[nbsp][nbsp] ErrorDocument 404 /Tools/NotFound.html
This looks in a folder called Tools for a file called NotFound.html...
You can find this at http://www.aota.net/Tutorials/htaccess.shtml. It shows how to specify where to look for the 404 page, namely the root directory in the first example...
------------------
Justin Nelson
FutureQuest Support
frankc
06-16-1999, 10:05 AM
Justin, can you elaborate on more of the .htaccess trix or point us to other resources?
Thanks!
------------------
Frank
Hosanna! Lutheran Church[nbsp][nbsp]www.hosannachurch.com (http://www.hosannachurch.com)
Justin
06-16-1999, 02:18 PM
I think I'll be either rewriting the .htaccess tutorial or adding a second one for the more advanced stuff. At the time I wrote that, ErrorDocuments were the only thing I knew how to do with .htaccess, and I've learned a bit since then :)[nbsp][nbsp]I have a few other tutorial ideas for the near future (when I get some free time :))
PS - you will find a lot of the directives here: http://www.apache.org/docs/mod/directives.html - if[nbsp][nbsp]the Context line contains .htaccess for a particular directive then it can be used there.
HTH
------------------
Justin Nelson
FutureQuest Support
[This message has been edited by Justin (edited 06-16-99)]
vBulletin® v3.6.8, Copyright ©2000-2013, Jelsoft Enterprises Ltd.