Reputation: 2222
I'm using vanilla forums which already has these rewrite conditions and rules in .htaccess:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
What I would like now is to add some rewrite rules that ask for authentication (Require valid-user) only when I am on the page /vanilla/index.php?p=/categories/general, ie just the query string "p=/categories/general"
Thank you for your help!
Upvotes: 2
Views: 732
Reputation: 69977
It isn't possible to add authentication based on the query string of a URL as far as I can
tell.
Using mod_rewrite
, you can only rewrite one URL to another, not specify additional configuration rules.
The <Location> tag can be used to match a URL and require auth, but Location
cannot match query strings so it won't work in your case.
Is there a reason you need to use .htaccess
authentication? Could you build the logic into the PHP script easily?
Upvotes: 1