James John – Software Engineer

Removing WWW in your domain name using .htaccess

Removing WWW in your domain name using .htaccess

Hi all,

If we go to SEO we see that Spiders indexes your site both in WWW. and normal without WWW, now this will not that good in SEO as my boss told me…you have to make it use one only and this works only using .htaccess.

Login to your Cpanel, locate your .htaccess (usually hidden in some cpanel, check on show hidden files).
Edit it and put this code in it

  1. #REMOVING WWW.
  2. RewriteCond %{HTTP_HOST} !^yoursite.com$ [NC]
  3. RewriteRule ^(.*)$ http://yoursite/$1 [R=301,L]

This line of code is just talking about, if it is not yoursite.com, re-write it to yoursite.com, you can see my forum dont use www both in Search engines!

Hope it helps :D

James John

Software Engineer