Server Fault is a question and answer site for system and network administrators. 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

Server: Apache 2.2.17

I have the next .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule !^includes/ - [S=1]
RewriteRule ^includes/[^/]+\.php$ - [F,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

As you can see, I'm forbidding users to access all php files that are inside the "includes" directory. Besides php files, I also have another directory and an image inside "includes", but I don't have an index file. So why forbidding all php files this way denies access to the directory listing?

PHP files are forbidden, and I can access the image and get inside the other directory inside "includes". But the listing of files in the "includes" directory is denied. Why?

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.