1

The structure of my url is http://www.somesomewebsite.com/ShowProduct.aspx?ID=12.

I am doing a permanent redirect (301) to http://www.somewebsite.com/product-category/12/this-is-my-product-name/. However if the user types just http://www.somewebsite.com/product-category/12/ he/she is given a 404 error.

What should my Canonical URL point to?

http://www.somesomewebsite.com/ShowProduct.aspx?ID=12

OR

http://www.somewebsite.com/product-category/12/this-is-my-product-name/
  • I think the problem is you're just redirecting people, and you aren't rewriting urls. Or you're doing it wrong. People coming from direct channel should arrive in your pages without getting a 404. Canonical urls come later. – lucgenti Jun 4 '15 at 17:07
  • Sorry if I miscommunicated but if a user directly types 'somewebsite.com/product-category/12/this-is-my-product-name' then he is shown the page contents. But if you observe the urls of stackexchange, even if the user types 'webmasters.stackexchange.com/questions/81906' he is redirected to the correct page. In my case that doesn't happen. – CuriousDev Jun 4 '15 at 17:09
  • No sorry, my fault. After re-reading now I get. You should do another proper redirection to "catch" people missing last part of the urls. If 12 is a unique ID, take advantage of it and write a new rule for that. – lucgenti Jun 4 '15 at 17:25
  • Hmm does your suggestion conflict with Mike's answer? I am not advertising the link structure 'somewebsite.com/product-category/12' anywhere. It is always the full url that I will be using while promoting the product. – CuriousDev Jun 4 '15 at 17:32
  • Some users or crawlers may try to visit the directory structure. Putting in a redirect for that will prevent 404 errors. – Stephen Ostermiller Jun 4 '15 at 17:37
2

The canonical URL should be the URL you want Google to show in their search results. So:

http://www.somewebsite.com/product-category/12/this-is-my-product-name/
  • Thanks for your answer John. In this case, is it OK if I skip the canonical url altogether? – CuriousDev Jun 4 '15 at 17:07
  • Yes since the 301 redirect will take care of preventing Google from indexing both URLs – John Conde Jun 4 '15 at 17:10
  • Perfect. In that case I will skip it. Lastly do you know of any tool that can tell me if my SEO is correct and if I have not made any mistakes in redirection etc.? – CuriousDev Jun 4 '15 at 17:16
  • Just use Firebug to visit the original URL. You can see the redirect headers in there. – John Conde Jun 4 '15 at 17:17
  • ok so it should show a 301 to the new url and 200(Ok) in front of the new url. That's it right. – CuriousDev Jun 4 '15 at 17:19
0

When making URLs available to the public, always try the friendly URL approach instead of the old fashioned approach. This means you want:

http://www.somewebsite.com/product-category/12/this-is-my-product-name/

I am doing a permanent redirect (301) to http://www.somewebsite.com/product-category/12/this-is-my-product-name/. However if the user types just http://www.somewebsite.com/product-category/12/ he/she is given a 404 error.

This URL:

http://www.somewebsite.com/product-category/12/

doesn't get crawled by anything unless it is advertised anywhere on the web (including your website) without the "nofollow" keyword included in the anchor tag pointing to the link.

For example, submitting the above link to a sitemap will cause the search engine to crawl it.

The above link producing a 404 does not need attention at this time until you are almost ready to make it public.

  • Thanks Mike. No I am not advertising that half url anywhere. I just saw Stackexchange doing it and thought it might be important, hence mentioned it. – CuriousDev Jun 4 '15 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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