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

I have a filesmatch directive in my .htaccess file:

<filesMatch "admin">
    AuthUserFile /var/www/html/.htpasswd
    AuthType Basic
    AuthName "Protected Area"
    require valid-user

It matches (and sub-pages such as /admin/edit_page)

But not

(I also have a mod_rewrite rule to hide the index.php from most of the website, don't know if this conflicts).

The mod rewrite rule:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /

 #Removes access to the system folder by users.
 #Additionally this will allow you to create a System.php controller,
 #previously this would not have been possible.
 #'system' can be replaced if you have renamed your system folder.
 RewriteCond %{REQUEST_URI} ^system.*
 RewriteRule ^(.*)$ /index.php?/$1 [L]

 #Checks to see if the user is attempting to access a valid file,
 #such as an image or css document, if this isn't true it sends the
 #request to index.php
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php?/$1 [L]
share|improve this question
It would help if you posted the mod_rewrite rule as well; it's impossible to see any conflicts otherwise. – Jenny D Jul 5 '12 at 10:27
Added now, thanks – yrondex89 Jul 5 '12 at 10:38

FilesMatch matches physical filesystem objects. index.php/admin is not one of those.

share|improve this answer
Is there a directive which would match a generic "admin" path? – yrondex89 Jul 5 '12 at 12:48
Well caught! I've not tried it, but LocationMatch might work. – Jenny D Jul 5 '12 at 14:11

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.