When should you use 301 redirects on your website? When is the rel=canonical attribute the better solution? This week’s article helps you to find the right solution for your situation.
What is a 301 redirect?
A 301 redirect is a server-side redirect that shows search engines that your page has moved to a new URL. 301 redirects pass nearly all of the link power of the old URL to the new URL. In general, 301 redirects are the best way to direct Google and other search engines to the correct page.
When should you use 301 redirects?
301 redirects are the best solution if you’re moving your website to a new domain or if you’re changing the URL structure of your web pages. Search engines and users won’t see the old URLs of your website then.
You should also use 301 redirects to make sure that search engines index only the www. (or the non-www.) version of your website. For example, this link goes to MaineHost.com without the www. The server automatically changes it to www.MaineHost.com to make sure that search engines index only one variation of the page.
What is the rel=canonical attribute?
The rel=’canonical’ attribute is an HTML element that enables webmasters to prevent duplicate content issues by specifying the “canonical”, or “preferred”, version of a web page.
For example, the same web page could be available in a web version and a print version. By using the rel=’canonical’ attribute in the print version, you show search engines that the web version is the version that should be found in the search results.
- A link tag with the rel=canonical attribute looks like this:
- <link rel=”canonical” href=”https://mainehost.com/” />
- The tag must be inserted in the head section of a web page.
When should you use the rel=canonical attribute?
- The canonical attribute is useful if your website creates dynamic URLs with every visit. For example, your URLs might contain tracking variables or visitor information:
- The canonical attribute shows search engines that the pages with the different variables are the same and that they shouldn’t count as duplicate content.
- The canonical tag is only a suggestion. Google sees rel=canonical as a hint, but not as an absolute directive like a 301 redirect.
You should also read: