Search
Close this search box.
Search
Close this search box.

URL Canonicalization: redirect non-www to www urls

How can I find if I have a canonicalization problem with my site?

Say that you want to check the site www.example.com.

01. Type in the browser

http://www.example.com

Check if it returns http://www.example.com.

02. Type in the browser

http://example.com

If the browser returns http://example.com (without the www), then you have major problem. Basically, what hapens is that google sees two different sites (one with the www and the other without the www) and not one identical site.

Why should I fix this canonicalization problem?

You should fix for the following reasons:

01. Duplicate content: Google sees the exact same content on two different sites, so it may consider that it is duplicate content. Not good.

02. Backlinks: Say that 300 sites link back to your site. 100 of them link to you using www.example.com, while the rest 200 link to you using example.com. Basically, you split your backlinks to two different sites.Not good at all.

How can I fix this problem?

01. Using cpanel

  1. Begin by logging into cPanel
  2. Select the Redirects icon under the Domains area of your cPanel home page.
  3. Keep the Type as the default, Permanent(301).
  4. Select your domain name from the drop down menu on the next line.
  5. In the redirects to text box, type in the full URL of your domain, including www (e.g. http://www.yourdomain.com).
  6. Select the radio button next to Do Not Redirect www.
  7. Click the Add button to add your redirect

02. Using .htaccess

01. If your host supports it (all major hosts support it, don’t worry), you can do a permanent redirect (a 301 redirect) of the non-www url to the www url.

This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled. If you do not know the kind of server you have visit http://www.salescart.com/products1/netcraft.htm to find out.

02. Open notepad (open it, do not right click on desktop and create new text doc), paste in it

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

and save it as ‘.htaccess’ (with the dot).

03. Put the .htaccess file it in your root server (where the index.html file lies).

To test the redirect, just type http://example.com. The browser should now return http://www.example.com.

Problem fixed!