Reputation: 2451
I have a /public folder in which there is an .htaccess file with a lot of rewrite rules.
We are making a new folder at /public/news, the rules of the first .htaccess file apply in this folder too and that's undesirable.
I don't have access to server's virtual host definition so my only other option is to put exceptions in every rewrite rule in the /public/.htaccess which is not preferable.
I was wondering if I could put a new .htaccess file in /public/news so that it will disable all the effects of the first .htaccess
Upvotes: 0
Views: 190
Reputation: 2451
The suggested answer above works, but I was hoping to find a way so that I don't have to modify /public/.htaccess
The solution was to put
RewriteEngine off
In /public/news/.htaccess
Upvotes: 0
Reputation: 2651
Add this to your /public/.htaccess
at the top (before other rules, after RewriteEngine On
):
RewriteRule ^news(.*)$ - [L]
It will not rewrite anywhere because of the -
, and the [L]
will cause the current .htaccess
to stop processing more rules (the last
flag). Then the /public/news/.htaccess
can take effect.
Apache Mod_Rewrite Documentation
Upvotes: 1