Forum Moderators: phranque

Message Too Old, No Replies

Redirect url's containing "?tag=" to main domain

         

Ma2T

4:20 pm on Sep 24, 2006 (gmt 0)

10+ Year Member



Hey everyone,

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

Ma2T

5:14 pm on Sep 24, 2006 (gmt 0)

10+ Year Member



I have just found the following code fo removing sessionids's fom jdMorgan.

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