user1856596
user1856596

Reputation: 7233

Allow single URL from htaccess file using a regex?

I am trying to allow a single URL using SetEnvIf Request_URI in my htaccess file only if it contains "/lib/minify/m.php". This is how it looks:

SetEnvIf Request_URI .*/lib/minify/m.php noauth=1

Later, after the basic ath stuff, I added this line:

Allow from env=noauth

Its not working and I think the regex is wrong. How do I have to write the regex so it checks for "/lib/minify/m.php" within the request url?

Thanks!

Upvotes: 0

Views: 181

Answers (1)

anubhava
anubhava

Reputation: 785481

Regex may work but can be corrected further like this:

SetEnvIfNoCase /lib/minify/m\.php noauth

Then use it like this:

AuthType Basic
AuthName "Login Required"
AuthUserFile /path/to/passwords
Require valid-user
Order deny,allow
deny from all
allow from env=noauth
Satisfy any

Upvotes: 0

Related Questions