The search engines treat query strings (ie. the stuff after the question mark) as a part of the URL in the links they index. So, if they see two URLs pulling up the same content they will consider one or the other as a duplicate. This can lead to real trouble when you change affiliate tracking systems or any other navigation aid that relied on adding a Query String to an important URL on your site. The solutions are simple. In this SEO tutorial, I'll explain how session IDs, tracking codes and other query string parameters can affect your rankings and how you can use Google's Webmaster Tools to prevent and repair the problems they can cause.
The most common method of removing URLs containing extraneous query
strings from the search engines is to install
301 redirects from the version of the URL that includes a query string to the same URL
without it. The method you use to do this depends on the server software that your host
uses. On an Apache-based server, you could use the following code in an .htaccess file:
Of course, this might not be the best solution in every case. Using a tracking code sometimes implies the use of a counting mechanism, and simple redirects to the same URL with the query string removed will not always get the job done. If all you need is the entry in your server log file in order to manage the task, then you don't need to do anything more. However, if your tracking system relies on software to handle the counting, then you need an intermediary step.
There are a couple of ways to handle this situation, but I think the simplest is to simply let mod-rewrite re-route the request to a counting script with the information embedded in the request URL for that script. Then, once the script has run to completion, it can seamlessly emit the 301 redirect to the destination page. I'm thinking the .htaccess code would be something like:
Once you've installed the redirect, be sure to test it with my
HTTP Server Response Header Checker. Enter a URL for
your site that includes the tracking code and make sure it returns the proper
response code, including the new "Location:" URL.
You can also use the Webmaster Tools provided by Google and Bing to tell them to ignore specific query string parameters. In Google's Webmaster Tools console, select Crawl -> URL Parameters. Press the "Add Parameter" button and enter the name of the query string parameter you wish to block. Then, select "Ignore".
In the Bing Webmaster console, select Configure My Site -> Ignore URL Parameters. Enter the parameter name in the input box and press the "Submit" button.
If the pages involved do not normally have any query string parameters, you can also use the simpler rel="canonical" tag. You'll find more information about both of these methods in my Search Engine Canonicalization article.
This SEO Tip by Rainbo Design was last updated on June 13, 2015
Need More Help?
You'll find more SEO Tips on the menu on the right side of this page.
You can also contact me with your SEO questions.
If you can't fix your website search engine problems on your own,
my Search Engine Optimization Services
can give your website what it needs to get your business' fair share of search engine traffic quickly, without disturbing your website's design, and without breaking your budget.
Call Richard L. Trethewey at Rainbo Design in Minneapolis today at 612-408-4057 from 9:00 AM to 5:00 PM Central time
to get started on an affordable website design package or search engine optimization program for your small business today!
In writing these SEO tips, I'm often reminded of a pearl of wisdom that my high school computer programming teacher passed on from one of his teachers, "Computers are high-speed idiots!" Remember that, and don't let them get under your skin.