Forum Moderators: phranque
I'm hoping someone who knows more about .htaccess than me (prob 99% people here!) can help me out.
Unfortunately google has got hold of a lot of incorrect urls, which are the same page.
I need to redirect any urls that contain "?tag=" to my main domain.
Eg
[site.com...]
[site.com...]
[site.com...]
I would like to redirect these any many more (any that contain "?tag=" directly to "http://www.site.com/"
Someone recommended the following, but it does not seem to work.
RewriteEngine on
RewriteCond %{QUERY_STRING} tag=([0-9]+)
RewriteRule ^index.php$ [yourdomain.com?...] [R=301,L]
Many thanks for your help.
Cheers
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
#
RewriteCond %{QUERY_STRING} PHPSESSID=
RewriteRule ^page-name\.php$ /page-name.php? [R=301,L]
=======
Which I edited to:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
#
RewriteCond %{QUERY_STRING} tag=
RewriteRule ^index\.php$ /? [R=301,L]
This seems to redirect to the main domain correctly, and contains the 301.
I belive this is correct, if it is not, could someone please let me know.
Thanks to jdMorgan