Google Webmasters Tools has notified me about too many duplicated URLs. Some parameters have been added that I don't know about and I need to remove it, for example:


And this is marked as a duplicate URL on Google. How can I block ?=collcc or remove it with .htaccess. Or preferably remove just ?collcc= and redirect to the normal URL with .htaccess?

I know I can block in robots.txt file but I need clean URL still indexed on Google so I need to remove just the query collcc.

I have tried:

RewriteCond %{QUERY_STRING} collcc=
RewriteRule (.*) http://my-site.com/$1? [R=301,L]
RewriteCond %{QUERY_STRING} collcc=
RewriteRule (.*) http://example.com/$1? [R=301,L]

This should already have "worked". It should have removed any query string, providing "collcc=" was found anywhere in the requested URL's query string.

This is assuming you aren't getting any "errors" and mod_rewrite is already enabled, with the appropriate directives. For example:

Options +FollowSymLinks
RewriteEngine On

The other possibility is that your directives are located in the wrong place in your .htaccess file which is resulting in a conflict with existing directives. This redirect will need to go near the top of your .htaccess file, before any existing rewrites.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.