Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a directory with several sub directories. I found this article Preventing Directory Listing that shows me how to prevent people from getting the directory listings.

IndexIgnore *

But it produces a bad error page, (it looks like an empty directory listing). Instead I would like to redirect the user to a page or show a better error page when they try to view the directory listings of a sub directory.

I am using Apache

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Try this:

Options -Indexes
ErrorDocument 403 /path/to/403.html
share|improve this answer
    
I get a 403 error. I checked that my 403.html document exists and is publicly available. I also used the full path. 'Forbidden You don't have permission to access /files/2011/ on this server. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.' –  Steven smethurst Oct 28 '11 at 20:00
    
Read server's logs for 500 error description. Can also show relevant part of config –  Lazy Badger Oct 29 '11 at 4:02
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.