This is the file tree:
- /problem/
- /problem/index.php
- index.php
- category.php
- somefile.php
I have this 2 rules in the .htaccess that is sitting in the /
RewriteRule ^somedir$ /somefile.php [L]
RewriteRule ^([a-z-]+)$ /category.php?cat=$1 [QSA,L]
So…
- http://domain.com/somedir = OK
- http://domain.com/ = OK
- http://domain.com/problem/ < automatically adds ?cat=problem to the querystring. I want to avoid that extra ?cat=problem
I need to add a rule that doesn’t add the cat=$1 when the /dir/ exists.
Just add a
RewriteCondbefore your second rule. Basically, don’t run that catch all if it starts withproduct:To prevent redirecting for a real file or directory, add these two lines before the rule: