3

I read this post here: What is a best canonical URL for a search result page?

and I have search page which can set more than one item like this:

example.com/search/index.php?keywords=fruits_bananas_apples

Which would be better for a canonical URL:

example.com/search/index.php

or

example.com/search/index.php?keywords=fruits_bananas_apples

  • Firstly, it's not really recommended to use commas in your URLs, see my answer here about that. Second, what are you trying to accomplish with a canonical URL here? Are you concerned about duplicate content, or do you want search engines to index only one page (i.e., the search page), or something else? – dan May 25 '16 at 05:48
  • concerning about duplicate content. – Naofumi Fujii May 25 '16 at 05:49
  • 1
    Are you implying that searches with different options will produce very similar pages? If so, then you could either add a canonical URL to just the search page (the first URL above in your question), or do as John Mueller (from Google) suggested in the linked question: Search pages should be disallowed from crawling with the robots.txt. – dan May 25 '16 at 05:55
  • 1
    thanks dan!

    Search pages should be disallowed from crawling with the robots.txt

    this is exactly what i wanted. thanks for the information

    – Naofumi Fujii May 25 '16 at 05:58
  • No problem. I see you edited your question to change commas to undscores...FWIW, those aren't much better (use dashes, ampersands, or pluses instead). See this for more: Matt Cutts - Dashes vs. underscores. Good luck! – dan May 25 '16 at 06:02
  • thanks again! by the way, how can i close this question? any way to mark as resolved or something similar? – Naofumi Fujii May 25 '16 at 06:03
  • You can answer it yourself based on the information above and accept it, or leave it for someone else to for the reputation points (I'm not answering questions myself so others might have an opportunity to). – dan May 25 '16 at 06:06

2 Answers2

2

Search pages should be disallowed from crawling with the robots.txt

see John Mullers comment on What is a best canonical URL for a search result page?

thanks dan!

1

In general it might be a good idea to block crawling of search result pages, but there are cases where it can makes sense to allow crawling.

For example, if your search is the only or the primary way to navigate the site, and especially if you offer filters (or search operators) with pre-defined search terms. So instead of having a separate /category/ namespace (e.g., /category/movies), some sites use the search function for this: /search/category:movies.

And besides that: Even if you disallow crawling of search result pages, it can still make sense to provide the canonical link type for these pages (all kinds of tools might use it, e.g., for bookmarking).

So here’s an answer to the original question:

It would be wrong to use example.com/search/index.php as canonical URL for example.com/search/index.php?keywords=fruits_bananas_apples.

RFC 6596 makes clear that the canonical URL

[…] MUST identify content that is either duplicative or a superset of the content […]

As /search/index.php does (most likely) not contain or include the content from /search/index.php?keywords=fruits_bananas_apples, it’s not allowed to be specified as canonical URL.

A case where it would be appropriate for a search result to use the canonical link relation (just as an example to give you an idea, probably not worth to implement this one): Assuming that the order of the search terms does not matter, you could decide to use the URL with the search terms in alphabetical order as canonical URL, e.g.,

/search/index.php?keywords=apples_bananas_fruits

for URLs like

/search/index.php?keywords=apples_fruits_bananas
/search/index.php?keywords=fruits_bananas_apples
…
unor
  • 21,739
  • 3
  • 46
  • 117