Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been setting up ErrorDocuments for a website I'm working, and generally they've been working. However, after I set the 403 ErrorDocument, I noticed that it didn't work when I tried to access the .htaccess file itself. When I access a different forbidden file, the Error Document appears just fine. How can I make the ErrorDocument work on the .htaccess file?

If you didn't follow my explanation, here are links to show you what I mean:
ErrorDocument works fine: http://keycraft.haydencity.net/.ftpquota
ErrorDocument doesn't work: http://keycraft.haydencity.net/.htaccess

share|improve this question
add comment

migrated from stackoverflow.com Nov 12 '11 at 0:08

This question came from our site for professional and enthusiast programmers.

2 Answers

The .htaccess file is most likely uploaded with your user permissions, allowing it to be viewed like any other file you might upload. The . at the front only makes the file hidden from the standard file list, so that people don't see it listed. It does not completely forbid access to the file.

Check the file's permissions and try to make them match whatever the permissions for the .ftpquota file are.

share|improve this answer
    
Okay, I tried setting .htaccess down to 600 (it had been at 755) and that just made both pages break (the .ftpquota page said it got a 403 error trying to retrieve the ErrorDocument from .htaccess). I think something else besides Apache is forbidding the .htaccess file, but I don't know what. The 403 error page appearing for the .htaccess says nginx; what is that? (lol im new to apache, clearly) –  oxguy3 Nov 11 '11 at 19:57
add comment

I suspect the issue is that your error document definition is in the file which is being accessed. Have you tried placing the ErrorDocument definition in an htaccess in the parent directory?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.