AffiliateBeginnersGuide
Affiliate marketing for beginners

contentp image
More Info »
| RSS Feed | sitemap | Contact 

» Home » Domains Guide


Domain names and duplicate content


Google webmaster tools and preferred domain

Google webmaster help says: "To gain more control over how your URLs appear in search results, and to consolidate properties, such as link popularity, we recommend that you pick a canonical (preferred) URL as the preferred version of the page".

Sentence above is important, not only for Google, for other search engines too. "www.yoursite.com" and "yoursite.com" (without www) are two different websites, although there is the same content. Then, we are talking about duplicate content, two version of the same web page under different url.

Also, links from other websites are sometimes with www, and sometimes without www. Search engine spiders are following those links and your website content is indexed under two version of the same domain (www and without www). Another problem is that links to www and non www version are diluting PageRank, importance of page.


How to set preferred domain in Google webmaster tools

Say that you have already www.yoursite.com added. To set preferred domain to www.yoursite.com, you need to add yoursite.com too and verify ownership. You don't need to upload verification file again (or add tag), just click "verify" and it is done. Now you can set preferred domain (www or without www).


What about "missing backlinks" in GWT

In many web forums webmasters are complaining that Google webmaster tools (GWT) not shows all backlinks. Check links to the second version of website. You will probably find missing backlinks there. Believe or not, sometimes one version shows backlinks to main page only, while second version of domain shows backlinks to other web pages.

This could be sign of potential problem. It could show that google prefer version of your domain where links to main page are shown. In that case, if website is newer, avoid to mention non-preferred version of domain anywhere, including text (not linked). However, check number of backlinks to non-preferred version of domain from time to time, and compare.


How to set preferred domain on website

If preferred version of domain is set in webmaster tools, that doesn't mean that job is finished. For Google, it is good to add canonical tag on every page on website, not only to set preferred domain, to avoid duplicate content issue, when the same page is called with different parameters.

This tag must be added between <head> and </head>

<link rel="canonical" href="http://www.yoursite.com/">
or
<link rel="canonical" href="http://www.yoursite.com/page.html">

That is for Google, this tag is still ignored from other search engines. For all search engines and for visitors and theirs browsers, 301 (permanent redirect) is the best solution.


How to redirect domain using htaccess

This is already explained in redirect domain using htaccess guide with more details, anyway here is again.

Add following to your htaccess:

Non-WWW to WWW version:

#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^yoursite\.com$
RewriteRule ^(.*) http://www.yoursite.com/$1 [R=301,L]

WWW to non-WWW version:

#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^www\.yoursite\.com$
RewriteRule ^(.*) http://yoursite.com/$1 [R=301,L]


Below is modified non-WWW to WWW version I am using:

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

Means: If it is NOT WWW version, redirect to WWW version


Base Href tag

According to my experience, no help from base href tag in this case. It is useful to partially protect website content from scrapers, here is the link to that guide: how to protect web page content


Redirect to preferred domain using PHP

While htaccess redirection is for a whole website, PHP example below is for individual page and it must be placed on top of page (no spaces before opening tag)

Non-WWW to WWW version

<?php
if(!stristr($_SERVER["HTTP_HOST"], 'www')){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.yoursite.com/" . $_SERVER["REQUEST_URI"]);
exit();
}
?>

WWW to non-WWW version

<?php
if(stristr($_SERVER["HTTP_HOST"], 'www')){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://yoursite.com/" . $_SERVER["REQUEST_URI"]);
exit();
}
?>


Don't forget to replace yourdomain.com with your domain name.



Bookmark and Share







how to set preferred domain

to top