Ad

Should I Use Rel="canonical" On My Homepage For Non Www To Www?

- 1 answer

I'm really confused about using the rel="canonical" on my homepage since my website is using www and non www. Should I be using

<link rel="canonical" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="https://www.example.com/" />

on my homepage since i prefer www, for when someone accesses my domain using a non-www?

Ad

Answer

You should definitely use canonical url on non-www version to avoid duplicated content problem. And this is true not for homepage but for every page of your website that can be opened with or without www subdomain.

But more preferable way to solve the problem is to configure 302 moved permanentrly redirect instead of rel="canonical". You can do this using your webserver config or .htaccess files.

Read more about how google handles duplicated content in their help article here: https://support.google.com/webmasters/answer/66359?hl=en

Ad
source: stackoverflow.com
Ad