How to Solve Canonical Issues for Websites for SEO

Canonical issues are a major problem of websites as long as Search Engine Optimization is concerned. If you are still unclear about website’s canonical issues, I must tell you what is it.

Let us talk about the domain name of a website, www.domainname.com if you type this in the address bar of your browser, homepage of the website will open up, you can get the same result by typing,

http://www.domainname.com/ (www version)
http://domainname.com/ (non www version)
http://domainname.com/index.html
or
http://www.domainname.com/home.php
or
http://domainname.com/index.php
or
http://www.domainname.com/default.aspx etc.

This is what is canonical issue which means your website is having different urls (Uniform Resource Locator) with the exact same content. Modern search engines are not smart enough to differentiate between canonical urls and genuine duplicate contents. In this case your website will be considered as a site having duplicate content which is a bad thing as far getting ranked in Search Engine’s Result Pages (SERP) is concerned.

There should be a way to solve this canonical issue..
301 redirection with .htaccess file is the solution.
Create a .htaccess file. Open Notepad. Name it as .htaccess.
Paste the below code into the notepad. You have to customize the code by replacing your own domain name. And in place of index.html you have to replace it with your home page file name. Another thing is, you have to decide whether you want www version or non www version of your cannonical url. Both are fine. But the common trend is www version. If you want non www version of your domain name just remove the www. portion from the code.

# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domainname\.com$ [NC]
RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.domainname.com/$1 [R=301,L]

In case of wordpress blogs the following code is needed. And you can set your www or non www version within the settings of wordpress dashboard.

Code is here

# BEGIN WordPress 
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] 
# END WordPress

You have created your .htaccess file now. Now your job is to upload the file into your web server’s root directory with the help of FTP  (File Transfer protocol).  You are done. Now check all different urls mentioned above are getting redirected to the canonical url you set up with your .htaccess file.

Bonus Tip: Try to use your canonical URL whenever you are getting links from other websites or other pages from your own site. This will escape a 301 redirection which is good for SEO. This is how you can solve your canonical issues and render your site more search engine friendly.

Comments

  1. I was looking for this information.Thanks for share this valuable post ..

    ReplyDelete
  2. I really like how your class timings of your blog. I enjoyed reading your blog and it is both instructional and interesting.
    Website Design Company Bangalore India

    ReplyDelete

Post a Comment