How to make sure all URL to your website uses www?


EXPERIENCING PROBLEMS WITH OUR SERVICES? RUN A DIAGNOSE FIRST TO SAVE YOURS AND OUR TIME

Added: 26.10.2008 12:47:46     Last updated: 26.10.2008 12:47:46

To make sure everyone visiting your website with the domain yourdomain.net has wwww. in the URL you will need to add the following code in .htaccess file:
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^dittdomene.net
RewriteRule (.*) http://www.dittdomene.net/$1 [R=permanent,L]

The benefit of this is to prevent search engines indexing both with and without wwww and therefore finding duplicate content. Duplicate content can cause lower ranking in search engines on search terms related to your website.

If you would like all URL to be without www you can change the last to lines like this:
RewriteCond %{HTTP_HOST} ^www.dittdomene.net
RewriteRule (.*) http://dittdomene.net/$1 [R=permanent,L]