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

I have a filesmatch directive in my .htaccess file:

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

It matches http://www.website.com/admin (and sub-pages such as /admin/edit_page)

But not http://www.website.com/index.php/admin

(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]
</IfModule>
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

1 Answer 1

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

 
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.