Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

Your Answer


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.