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 php script that relies on the following rewrite rules:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/script.*$ [NC]
RewriteRule (.*)$ script.php/go [QSA,L]

So when someone visits http://example.com/foo, the script is called script.php/foo. This should be publicly visible.

When I visit http://example.com/script.php/adminstuff/ I'd like to use http basic authentication. (I know how to use this in the basic case.) How will this react with the rewrite rules above?


share|improve this question

1 Answer 1

up vote 0 down vote accepted

You couold use <Location> tag:

<Location http://example.com/script.php/adminstuff/>
      AuthType xxxx
share|improve this answer
Is there something analogous that can be used in an .htaccess file? If not I can use this recipe, but I'd prefer to have it in .htaccess. Thanks. –  bstpierre Dec 21 '09 at 13:24

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.