Resources: Linux and Apache
Removing www from your site
26 July 2013
Personally I prefer web URL's to exclude www, and so I implement the following code on all project's .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.jamesbarnsley.co.nz$ [NC]
RewriteRule ^(.*)$ http://jamesbarnsley.co.nz/$1 [R=301,L]
Another reason this is important is that www.yoursite.co.nz and yoursite.co.nz are treated as two unique websites. Any SEO rankings for yoursite.co.nz does not apply to www.yoursite.co.nz!