Hey guys,
This seems like a simple issue to resolve, but what I’m doing doesn’t seem to work. I want to redirect a URL with a specific querystring to the root. For example:
The url:
http://mywebsite.com/?view=home
should redirect to:
http://mywebsite.com/
The code I’m using in my .htaccess file is:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^view=home$
RewriteRule ^/$ http://mywebsite.com/? [L,R=301]
But it’s not working. I’m not getting a server error, it’s just not recognizing the redirect, thus it stays at “?view=home”.
What makes this situation unique is that there is no “page” present in the URL, because I’m not displaying the “index.php”, but this doesn’t work either:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^view=home$
RewriteRule ^/index.php$ http://mywebsite.com/? [L,R=301]
Anyone have any idea how to properly redirect a URL with a querystring on the root (with no page in the url)?
Thanks,
Louis