Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just added my site to Google Web Master Tools and discovered that some links (for example: In the section "Search Query / Top pages") have a URL format like: example.com/page.php?id=1234

This format can also work, but all my internal links have a format like: example.com/1234. So I can only suppose that Google had scanned all those links before I made changes to my .htaccess file.

My questions are:

  1. Should I care about those non-user friendly links already in the index and hope that Google will correct itself soon?

  2. If I should - how do I remove those wrong links and replace with correct ones?

share|improve this question
up vote 3 down vote accepted

Should I care about those non-user friendly links already in the index and hope that Google will correct itself soon?

This depends on what you want search engine users to see in your search results: the clean URLs: example.com/1234 or URLs with parameters: example.com/page.php?id=1234

Clean URLs are generally more understandable and recognizable to search engine users, hence they're more likely to click on them. Since you went through the trouble of creating them, they would likely be your preferred version to index for your search results.

You can indicate to Google which of the two types of URLs to index is the preferred one, and hence avoid duplicate content issues, through canonicalization, in which you'd add a rel="canonical" link to the <head> section of the non-preferred URL's page pointing to the preferred URL.

If I should - how do I remove those wrong links and replace with correct ones?

To encourage search engines to drop the URLs with parameters in favor of the clean ones, you can 301 redirect the URLs containing parameters to the clean URLs using your web server (e.g., with an Apache .htaccess file), which will let search engine bots know they've permanently moved. Over time they'll enventually be dropped and replaced with the clean ones.

You should also add the clean URLs to your sitemap, and remove any URLs with parameters from it. Then you can resubmit your sitemap to Google. You might also use the Fetch as Google tool to trigger crawling for your site and the clean URLs.

Finally, you should also block the URLs with parameters from being crawled again by disallowing them in your robots.txt as covered here. For example:

Disallow: /*?id=

The / indicates the root directory, and * is a wildcard for anything up to ?id=, followed by anything after it.

share|improve this answer
Thank you, @den, for such clean and detailed answer! I will definitely follow your recomendations. If the parameter name (indicated as 'id' in your example) can be different, can I use robots.txt statement Disallow: /*? instead of Disallow: /*?id=? – Roman Matveev Jan 30 '14 at 6:55
And one more question: can I add rel="canonical" on ALL pages, including the pages already has canonical URL? In this case I will make more easy to write and read page code with no additional branches. – Roman Matveev Jan 30 '14 at 7:01
No problem. Yes, that Disallow will work however on all URLs with a ? in them. Regarding canonical links on the preferred/canonical page, that's fine - see the second graphic here. – dan Jan 30 '14 at 14:58

I agree with the other answer but would like to add one suggestion. Having gone through a similar situation, my suggestion is that you ask yourself if it's worth the effort to change a lot of urls or just a small number of the most important ones.

Go to Google and do a search. The keywords in the results will be bolded in three spots -- the title, the url and the meta description. The title has the largest type and gets the most attention as a result. The bolded keywords in the url enhance the results and even may contribute slightly to higher rankings but aren't necessary for getting clicks from searchers.

A user friendly url will not matter on links that show up on page 8, 10 or whatever on the search engines where people rarely seem them. They will matter for the ones on page 1.

I would correct the most important links with the highest ranks in the search engines and don't worry about the rest. I found they weren't worth the extra work of changing them and maintaining a lengthy 301 list.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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