Blog for web designers

www or without www in url

Use your domain with www or without www in URL. We must choose only one for the sake of SEO.
Do you want to your site address open with http://www.your-site.com or just http://your-site.com ?
Without this Google thinks that there is two URLs and find the duplicate content.

Head over to your .htaccess file in your root and copy the code you think its correct.

I suggest you to use this without www in url

With www

RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-site.com [NC]
RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301]

Without www

RewriteEngine On
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC]
RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]

Santosh Shah

My name is Santosh Shah and blogs at santosh-shah.com


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.