Controlling the domain name your site is known by
Do you think www.domain.xyz is the same as domain.xyz? They're not, and in fact they can easily be two completely different sites. The reason for this is rooted in the design of the domain name system. In truth www.domain.xyz is a subdomain of domain.xyz, and the domain name system doesn't care about the longstanding practice of putting www in front of everything.
The effect is to slightly fragment the popularity of your web site. It has to do mostly with the links pointing to your site. If some links point to http://www.domain.xyz/... and others to http://domain.xyz/... then the search engines tend to see those as two different domains, and then fragment the link popularity count between the two variants.
Here are a few steps you can take to ensure all the link popularity is centered on one variant of your domain name.
The first and simplest is to establish a CNAME record. This is done in the domain name configuration for your web site. Unfortunately the method used varies based on the control panel software used by your hosting provider. In any case you're looking to have two entries like so:
domain.xyz. IN A 220.127.116.11 www.domain.xyz. IN CNAME domain.xyz.
This makes www.domain.xyz an alias for domain.xyz. Hopefully the search engines will realize this and put the link popularity counts into the same clump.
Apache and permanent redirects
Much better though is to use what's called a 301 redirect. Redirects are used whenever a request for a specific page needs to be redone to request a different page. Redirects can be temporary, that is, the resource (page) in question is temporarily available at another location. And, redirects can be permanent, that is the resource (page) in question has permanently moved to another location. The 301 is the HTTP response code which says it's a "permanent redirect".
Again the method of installing a redirect will vary based on your hosting provider. Since most hosting providers use the apache I'll give some directions.
Generally your redirect needs to accept requests for pages under www.domain.xyz and return with the 301 response code telling the web browser to instead request the same page under domain.xyz.
In Apache this is done with the following configuration file entry. This is placed in the VirtualHost context that handles requests for www.domain.xyz.
Redirect permanent / http://domain.xyz/
This will handle any request on www.domain.xyz, take the part after http://www.domain.xyz/, and append that part to http://domain.xyz telling the web browser to request that instead. e.g. http://www.domain.xyz/about/index.html would become http://domain.xyz/about/index.html.
In the apache config file, the two VirtualHost contexts might look like this:
<VirtualHost *:80> ServerName domain.xyz DocumentRoot /home/domain/www </VirtualHost> <VirtualHost *:80> ServerName www.domain.xyz DocumentRoot /home/wwwdomain/www </VirtualHost>
In the directory /home/wwwdomain/www you would place a .htaccess file containing the Redirect line above.
A simpler alternative that doesn't require setting up another directory and use of a .htaccess file is this:
<VirtualHost *:80> ServerName domain.xyz DocumentRoot /home/domain/www </VirtualHost> <VirtualHost *:80> ServerName www.domain.xyz Redirect permanent / http://domain.xyz/ </VirtualHost>
PHP or ASP and permanent redirects
Another way to implement the permanent redirect us with a scripting language.
<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://domain.xyz/newdir/newpage.htm"); exit(); ?>
<%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location", "http://domain.xyz/newdir/newpage.asp" response.end %>