Hi, I am having trouble with a rewrite rule. I want to remove a certain query string "page=1&sort=featured" from any url on the site and I can't seem to get it working. This is the best I have come up with: RewriteCond %{QUERY_STRING} ^page=1&sort=featured$ RewriteRule ^([^\?]+)\?(.+)$ /$1 [R=301,L] Code (markup): I have been working on this all day and can't get it working. Please help. Thanks.
If I do this: RewriteCond %{QUERY_STRING} ^page=1&sort=featured$ RewriteRule (.*) http://ip_address/$1? [R=301,L] Code (markup): then the page http://ip_address/dir1/dir2/?page=1&sort=featured redirects to http://ip_address/index.php/dir2/. So it removes the query string but instead of "/dir1" being in there it's "index.php" for some reason. Higher up in the code there is: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php Code (markup): and I'm not sure if that is causing the index.php to go in there. It's kind of confusing that the (.*) doesn't match the entire url and only matches "/dir2" apparently. There is no RewriteBase defined and ip_address is because this is a dev environment.
It's a little confusing what you are trying to do. Can you start from scratch explaining your problem? Thanks.