click Posted January 23, 2006 Posted January 23, 2006 First, some background... I recently redid my site using PHP. I added "RewriteRule ^(.+)\.shtml$ /$1.php [R=301,NC]" to .htaccess to catch any references to the old .shtml files from search engines, links I missed, etc. Since I don't have any custom error documents, that caused a loop as apache would look for 404.shtml which would be rewritten as 404.php which would trigger another call for 404.shtml, etc. To correct this, I tried setting all the error messages back to the apache default using "ErrorDocument 40x default" in .htaccess but for some reason this triggers a 500 error. The end result, though, is that apache sends the default message with "Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request." tacked onto the end, which I figured was close enough for now. Anyhow, on to my problem... I have a directory set up to require authentication through .htaccess. When I try to access the directory, instead of getting a login prompt like before, I get a 404 page saying that /401.php could not be found. Removing the rewrite rule above, fixes it, which seems to indicate that apache is looking for /401.shtml and somehow finding it without the rewrite rule. So, best I can figure, apache is ignoring my .htaccess "ErrorDocument 401 default" altogether and using some phantom 401.shtml or something. Is there any way to force apache back to it's default rather than looking for a nonexistent error document? Why doesn't "ErrorDocument 401 default" work? Thanks for any help... -Steven Quote
TCH-Bruce Posted January 23, 2006 Posted January 23, 2006 Why not create custom error pages? 401.php, 403.php, 404.php? Quote
click Posted January 24, 2006 Author Posted January 24, 2006 Why not create custom error pages? 401.php, 403.php, 404.php? That would be far too simple! Actually, I do plan on making custom pages for the other errors (404, etc) but I'd have to look into making a 401 page since I'm not sure exactly how they work and I should be the only one using that folder so it didn't seem necessary. Anyhow, after researching it a little more, I don't think "default" for ErrorDocument works on apache 1.3, so I tried pointing 401 to a non-.shtml file that doesn't exist and it works great. Don't know why I didn't try that before... oh well. Until the next time I break something.... -Steven Quote
TCH-Rob Posted January 24, 2006 Posted January 24, 2006 Until the next time I break something.... Why does that sound familiar to me? Quote
abinidi Posted January 24, 2006 Posted January 24, 2006 Why does that sound familiar to me? I have to say that it sounds familiar to me too. However, the times I've learned the most have been the times I was fixing something I broke. 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.