Need help for htaccess rule

yazzou

Registered Member
Joined
Dec 19, 2008
Messages
61
Reaction score
7
Hi everyone and happy new year.
I am trying to remove some extra useless parameters from my URLs because in google webmaster tools, they are spotted as duplicate content .
Here is an exemple of what i see :

Code:
/subf/Page-15.html
/subf/Page-15.html?change_font=large


I would like to remove the change_font parameter. I have tried the following in my hthaccess :


Code:
RewriteCond %{query_string} ^.+
RewriteRule ^(.*)$ http://www.mysite.com/$1? [R=301,L]

However this remove some other parameters necessary for the site, so i tried the following :


Code:
RewriteCond %{query_string} ^.change_font
RewriteRule ^(.*)$ http://www.mysite.com/$1? [R=301,L]


I does not redirect....
Would be greateful for any suggestion
Regards
 
Use rel=canonical instead.
In your case it would look like this

HTML:
<link rel="canonical" href="http://www.example.com/subf/Page-15.html" />

Put it in head section of your code.
 
Back
Top