Modify your .htaccess file to make your site’s URL SEO friendly to www or no www.

If you type mysite.com or www.mysite.com it will redirect to same site but as per SEO standards both are different URL’s and it impacts on your site ranking.

 

How to correct it?

You must define this in your .htaccess file to either of link either user type mysite.com or www.mysite.com both must redirect to same link with or without www.

 

Add www

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

Remove www

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

Written by Ranjeet Jha

Ranjeet Jha

Hey there! My name is Ranjeet. I’m a Web Designer & Front-end Developer. I design, code, build & promote all things HTML5, CSS3, JavaScript & jQuery. In this blog you will find solutions of day to day problems faced by you.. Enjoy Coding..

Leave a Reply

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