Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Several sites that I have come across, including Stackoverflow, perform a 301 redirect when given an "incorrect" slug. For example:

http://webmasters.stackexchange.com/questions/9/incorrect-slug

will be redirected permanently to:

http://webmasters.stackexchange.com/questions/9/who-is-a-great-domain-registrar-company

But since assuming that the canonical URL is already specified, wouldn't the search engine point to the correct URL? What is the rationale for doing a redirect if the a page does not require the slug to parse correctly?

Further, is it a prerequisite to have at least a link pointing to the canonical URL in order for the page to be ranked? Will Google add search result to the canonical URL http://mysite.com/user/1/joe if all my links point to http://mysite.com/user/1?

share|improve this question

closed as too broad by bybe Sep 25 '13 at 9:02

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
'But since the canonical URL is already specified' - How do you know the canonical is specified if the page redirects? –  Max Sep 25 '13 at 2:23

2 Answers 2

up vote 4 down vote accepted

As you know, in Stack Exchange, edits can be made to the title. By this reason, for a single question, there can be generated as many URLs as titles had the question. Those older edited titles generate obsolete URLs that shouldn't exist and should 301 redirect to the fresh updated one.

301 redirect is better than rel="canonical", because you're avoiding Google from indexing crawling infinite pages (as you have infinite possible slugs) with the same content, all of them pointing to the same canonical.

rel="canonical" is better used for URLs that should exist, like URLs with parameters that generate the same content between them (i.e. in-site searches, URLs with tracking parameters), but that should not be redirected.

About your last two questions, in your case rel="canonical" will work fine because all generated links point to pages with the exact same content and Google finds it easy to associate them and not index the duplicated ones.

But you can't tell a search engine to "point" to the URL that you consider the best, Google may index both the canonical and the non-canonical if it considers that good for SERPs.

share|improve this answer
    
you're avoiding Google from indexing infinite pages with the same content do you mean that Google will still index the non-canonical page even if the canonical one is specified? –  Question Overflow Sep 25 '13 at 2:52
    
The second part of my question is not answered. –  Question Overflow Sep 25 '13 at 3:10
    
Google crawls pages with canonical, and actually indexes it, but it decides whether to show them or not using several signals support.google.com/webmasters/answer/139394, a very important one is that the page should have most of its content duplicated –  I.G. Pascual Sep 25 '13 at 7:33
    
updated answer... –  I.G. Pascual Sep 25 '13 at 8:20
1  
Thanks for the update, I have posted a similar question on meta and it reaffirms your final point. –  Question Overflow Sep 26 '13 at 3:42

Several sites that I have come across, including Stackoverflow, perform a 301 redirect when given an "incorrect" slug.

The web server for those sites is configured to redirect to a "catch-all" URL should a portion of the URL be missing. In the example you provided:

http://webmasters.stackexchange.com/questions/9/incorrect-slug

If anything after the 9/ is added, it will redirect to:

http://webmasters.stackexchange.com/questions/9/who-is-a-great-domain-registrar-company 

But assuming that the canonical URL is already specified, wouldn't the search engine point to the correct URL?

Canonical URLs are for indicating the preferred URL to index. In the case of redirecting an incomplete, non-existing URL to an existing one, canonical URLs are not really a factor - only the target page of the redirect will be seen.

What is the rationale for doing a redirect if the a page does not require the slug to parse correctly?

One reason for redirecting a non-existent URL to an existing URL is to keep the visitor on the site by showing a popular page (or question in this case) instead of an error page, which may lead to lower bounce rates.

Further, is it a prerequisite to have at least a link pointing to the canonical URL in order for the page to be ranked?

A canonical link is a link, so providing Google finds the canonical link somewhere, it may index it, depending on the criteria of its algorithm.

share|improve this answer
    
I don't think you should label a URL non-existent when it still works correctly. Of course I wouldn't be able to tell whether this is so on Stackoverflow since it forces a redirect. I am just questioning the rationale for doing so if search engines are programmed to read canonical URLs and index it properly. –  Question Overflow Sep 25 '13 at 4:37
    
In your example, http://webmasters.stackexchange.com/questions/9/incorrect-slug does not exist, regardless of the redirect. Again, canonical URLs are not a factor because it will never been seen by the search engine in a URL that's being redirected. See moobot's comment above. –  dan Sep 25 '13 at 5:02
    
I would agree with you if this is a static html webpage. But for Stackoverflow, I believe, the page is generated dynamically. What I am trying to say is that instead of forcing a redirect, Stackoverflow can design its site such that it accepts whatever slug it is given and generate the page with a canonical link pointing to the correct URL. It doesn't have to do a redirect unless there is a good reason to do so. –  Question Overflow Sep 25 '13 at 5:45
    
What's the benefit of generating a page with a canonical link for pages that don't exist, and wouldn't be indexed by a search engine in the first place? I provided a good reason why they might redirect to a page that does exists like they do. –  dan Sep 25 '13 at 6:03
    
An additional call to the database has to be made on each redirect because the redirect is handled by the page itself after polling the database and checking that an incorrect title is given. This is not something trivial that can be handled by the server config alone. The point is not about generating these pages with an incorrect slug, but the treatment by the search engine if someone were to edit the page title and hence changing the slug and whether such pages really require a 301 redirect or if the canonical link is sufficient, thereby conserving server resources. –  Question Overflow Sep 25 '13 at 6:19

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