Canonical redirects advice


(debbie kendall) #1

I have duplicate content identified because of a www and non www website so I need to add canonical redirects

Question 1: do i add the canonical redirect in the page inspector - html code - head area (RW7)
e.g. for the home page… <link rel="canonical" href="http://www.theenlightenedhound.com" /> to direct the non www pages to the www page

Question 2: do i have to add a page specific canonical link to every page… so on the about me page i could add…
e.g. <link rel="canonical" href="http://www.theenlightenedhound.com/about-me" />

Question 3: is the code i have written correct? about-me is a folder name and index.php is the filename so should the code be:
<link rel="canonical" href="http://www.theenlightenedhound.com/about-me" />
or
<link rel="canonical" href="http://www.theenlightenedhound.com/about-me.index.php" />

and similarly if I am redirecting to a sub page called ‘prints’ (that has subpages of its own) would the code look like this? (with the extra / after the folder name prints?)
<link rel="canonical" href="http://www.theenlightenedhound.com/prints/" />

Thank you :slight_smile:
Debbie


(Doug Bennett) #2

The best way to ensure you don’t get the duplicate content for WWW vs. non-WWW or https vs. http is to use a 301 redirect. There are a number of posts on how to do this, and it can vary by hosting company.

You can also set your preferred domain in the google search console:

https://support.google.com/webmasters/answer/44231

They way you are asking about “canonical link”:
Rel=“canonical” links need to be in the head section of each page. They indicate the preferred URL, but Google does state that "We attempt to respect this, but cannot guarantee this in all cases."
So each page will need a Rel=“canonical” links going to itself with the preferred URL for that page.

Make sure each URL is valid and not a “soft 404.” I suggest you test these links.
HTTPS preferred over HTTP for canonical URLs.
Here is the Google help page for Use canonical URLs:

https://support.google.com/webmasters/answer/139066?hl=en#2

And a couple of articles you may find helpful:
https://webmasters.googleblog.com/2013/04/5-common-mistakes-with-relcanonical.html


(debbie kendall) #3

Thanks very much for all that useful info… I decided to use the htaccess file for the non-www. to www. redirect with this code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^theenlightenedhound.com [NC]
RewriteRule ^(.*)$ http://www.theenlightenedhound.com/$1 [R=301,L]
Hope that is correct!