In case you’re one of those people still using www.x111.com you’ll now notice it automagically switches you to the non-www url. This is done because I want to ditch www, and because of a nasty side effect in search engines if you have www and non-www both working, which is the case in most shared hosting environments. Technically speaking www.x111.com and x111.com are 2 different sites as far as DNS and search engines are concerned. So both can get indexed, and as a result your PR and SERP goes down the toilet if they’re mixed.
You can get around this by using redirects, specifically the 301, which is the status code to tell the machine requesting the page that it has permanently moved to another location. You can use a .htaccess to manage the redirects but an even better way if you manage your own server is to use Apache’s httpd.conf.
The way I’ve done it is this, previously a virtual host section would look like:
<VirtualHost *:80>
ServerName domain.com
DocumentRoot /home/domain/www
ServerAlias www.domain.com
</VirtualHost>
Now we remove the ServerAlias and set up a new virtual host for it in which we’ll define the redirect for www.domain.com, so we’ll have 2 virtual hosts as such:
<VirtualHost *:80>
ServerName domain.com
DocumentRoot /home/domain/www
</VirtualHost>
<VirtualHost *:80>
ServerName www.domain.com
Redirect 301 / http://domain.com/
</VirtualHost>
Save, restart Apache and you’re done, from now on all www urls will automagically be redirected to their non-www counterpart and your rankings will correct themselves as the search engine spiders crawl your site and work their magic.