A client has a site where the URLs have a parameter for related products. For instance, the page for product A has been indexed as:
www.website.com/A
but also as
www.website.com/A?related-to-B
and
www.website.com/A?related-to-C
etc.
The content for all these URLs is exactly the same, which causes duplicate content issues and a number of total indexed pages which is about 10 times his real amount of pages.
How can I tell Google to 301 every indexed page that has ?related-to-X
back to the page without it? The website is in PHP.
(I assume this is a problem many have encountered before through affiliate links, so I guess the solution should include modifying the HTTP headers)