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="" /> 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="" />

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="" />
<link rel="canonical" href="" />

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="" />

Thank you :slight_smile:

(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:

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:

And a couple of articles you may find helpful:

(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} ^ [NC]
RewriteRule ^(.*)$$1 [R=301,L]
Hope that is correct!