Search This Site
 

Google Canonical problems - www versus non.www

How is your site indexed?

Is your website indexed as your-domain.com AND www.your-domain.com? How can you tell? Type site:your-domain.com in Google Search (Figure 1.)

Screenshot Google Site Search.
Figure 1: Google Site Search

What you should see is something like Figure 2 with a list of all the pages Google has indexed.

Screenshot Google Site Search Results.
Figure 2: Google Site Search Results

Now type in site:www.your-domain.com/

Do the search results show the same number of pages? No, then you may have a problem with Google considering your pages duplicate content because of Google Canonical problems. That is, when you have your site accessible both under your-domain.com and www.your-domain.com.

Create 301 Permanent Redirect

N.B.  If your site is hosted on the RootsWeb servers you will NOT have access to the .htaccess file.

To avoid Canonical problems you can create a 301 permanent redirect which will redirect the url you DON'T want to use to the url you WANT to use.

  1. Open Notepad or any plain text editor
  2. Type the  following lines
    Options +FollowSymLinks
    RewriteEngine On RewriteCond %{HTTP_HOST} ^expression-web-tutorials\.com$ [NC]
    RewriteRule ^(.*)$ http://www.expression-web-tutorials.com/$1 [R=301,L]
  3. Save the file as .htaccess
  4. Upload the file to the root directory of your server with your ftp program making sure to select ASCII as the transfer type

This will redirect any request for your-domain.com to www.your-domain.com. You can check to see if the redirect is working by doing a header check which will return the following (Figure 3)

Screenshot header check for 301 permanent redirect.
Figure 3: Header check for non www version of site

Figure 3 shows you the my-domain.com has been permanently moved (redirected) to www.my-domain.com

You should also create 301 permanent redirects for changing file names.