Filled Under: ,

Enforce Browser To Add WWW Before Your Website

Share

Hello I am Tapan Kumar




Introduction




Its very important in the eyes of Search Engine Optimization to render your website with a www in the beginning. If your site is being rendered with a www and also without a www then there is a big problem.



To overcome this issue lets find out a solution.






Behind The Scene






lets consider your website's name is "www.tapankumar.in" , So when you type www.tapankumar.in in the browser then it will open the site. Again if you type tapankumar.in in the browser then also it will open the site.



Now the problem is that when a search engine like Google try to crawl your site it will find TWO - 200 response against "www.tapankumar.in" and "tapankumar.in" ,  Hence the search engine consider this as a duplicate url.



You need to resolve this issue in order to get better SEO results, and here is a way to do this using your .htaccess file.


 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.tapankumar\.in$ [NC]
RewriteRule ^(.*)$ http://www.tapankumar.in/$1 [R=301,L]
</IfModule>

Now put the above code into your .htaccess file, and this will prepend a "www" before your website address automatically. 




Happy Coding...