Here is my .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP_REFERER} !^http://shop.com/index.php?controller=authentication&back=my-account [NC]
RewriteRule (.*) http://shop.com/index.php?id_category=12&controller=category [R=301,L]
I want :
- my
index.phpto be redirected toindex.php?id_category=12&controller=category. - override this redirection if the Referer is equal to
http://shop.com/index.php?controller=authentication&back=my-account
It seems the third RewriteCond, which is supposed to create the exception, doesn’t match the request to index.php when the Referer is equal to http://shop.com/index.php?controller=authentication&back=my-account. As a result, the RewriteRule is taken into account, whereas it shouldn’t.
This behavior makes me think %{HTTP_REFERER} doesn’t include params in URL (in this case: id_category=12&controller=category).
It does. You just have to escape the question mark. Try this: