I have read a Google guideline About rel="canonical" and I have known that

A canonical page is the preferred version of a set of pages with highly similar content.

I have a search page which URL is appended by search keywords, for example, when user searches "fruits" or "apple" or "banana", the URL will go like these:


All of these URLs will rewrite to the page example.com/search/index.php?keywords=xxx What is the best canonical URL for better SEO?

So far, the page has no search result when user types the URL manually without keywords example.com/search. Will it be a best canonical URL if I make a query to show a best result for no keywords?

I have also a weight calculation on the user search keywords. If more users find "fruits", it has a greater weight, for example, fruits = 100, apple = 50, banana = 10. It means 100 users search for "fruits", 50 users search for "apple" and so on. In this case, would the URL example.com/search/fruits be the best for canonical?

The search result may vary on the search keywords. It may be or may not be duplicate contents. I'm not sure how I should handle the canonical URL for this situation.

  • 1
    Note that if you do a 301 redirect from example.com/search/fruits to example.com/search/index.php?keywords=fruits then by definition the first page (search/fruits) does not exist and canonical should not point to a page that 301 redirects. Jan 19, 2014 at 0:08
  • @AlexisWilke, it is not 301 redirect. It is just an apache URL rewrite rule.
    – Sithu
    Jan 19, 2014 at 3:43
  • Ah! Okay, then I personally would use example.com/search/fruits because search engines may not properly interpret your query strings. Although generally they understand both, to increase your change that it works properly... Jan 19, 2014 at 3:57
  • 1
    Search pages should be disallowed from crawling with the robots.txt :) Jan 21, 2014 at 21:28
  • Also, words in URLs are overrated, don't lose time thinking about that. Jan 21, 2014 at 21:29

1 Answer 1


Search engine robots don't perform searches on your site directly (i.e., using search forms). In order for them to crawl and index search results, the search parameters would have to be contained within URLs, like:


Then robots can crawl these if found in the content of your site, your sitemap, or in external links pointing to your site. Otherwise, they won't be crawled so you don't have to be concerned with deciding what the best canonical URL would be.

If they are in that format and can be found however, search engines like Google will just decide which URL to display based on what they think is the best one, as indicated here:

When Google detects duplicate content, such as variations caused by URL parameters, we group the duplicate URLs into one cluster and select what we think is the "best" URL to represent the cluster in search results. We then consolidate properties of the URLs in the cluster, such as link popularity, to the representative URL. Consolidating properties from duplicates into one representative URL often provides users with more accurate search results.

You can also use the tool in Specify how Google should handle parameters, which includes options for:

  • Let Googlebot decide. Googlebot will analyze your site to determine how best to handle the parameter. This is a good general option.

  • Only URLs with value=x. Googlebot will crawl only those URLs where the value of this parameter matches this specified value.

  • No URLs. Googlebot won't crawl any URLs containing this parameter.

The first option would just let Google choose how to index the search URLs, which is a good general option as indicated.

If you consider "fruits" to generally be a more relevant category to search engine users than a specific category like "apple", then you could use the second option to specify that Google crawl only a URL with the following search parameter:


Using the last option, you could tell Google not to crawl any URLs with search parameters, and instead simply have the main search page (example.com/search) indexed so that search engine users would just see that page and perform their own searches.

In Summary - You can do any of the following:

  • Let search engines select the best search results page/URL to index.
  • Use the above tool to select just the more general "fruits" URL to index, or block the other search result pages in your robots.txt file or by adding a noindex meta tag to them.
  • Exclude all the search result pages using the above tool, or by blocking them in your robots.txt or by adding a noindex meta tag to them.
  • Block all search result pages and just have the main search page indexed alone.

The choice really depends on what you want to have indexed for your site.

  • I use Apache RewriteCond and RewriteRule to rewrite example.com/search/fruits to example.com/search/index.php?keywords=fruits. Then, what URL and parameters will Google crawl? search/fruits or search/index.php?keywords=fruits?
    – Sithu
    Jan 19, 2014 at 4:35
  • It depends on the type of rewrite rule you're using: if it's a 301 permanent redirect (i.e., R=301) then Google would index example.com/search/index.php?keywords=fruits because it was permanently redirected to that URL. So the URL parameter for that would be keywords=fruits. This was my assumption above. However, if it's not a permanent redirect, then you could just add a canonical URL on all the other search pages to example.com/search/fruits instead to have just that page indexed and not the other search pages.
    – dan
    Jan 19, 2014 at 8:01

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