Remove WWW prefix in your domain name, or vice versa
I was doing some SEO for my site the other day when I came across some inconsistencies in my website URL. Some appears to be adorr.net while the rest are www.adorr.net.
Do note that this only applies to Linux hosting accounts.
This can be annoying for search engines listings, and even cause mismatching paths when using Google Webmaster Tools to submit sitemap.
This issue however can be easily fixed by modifying .htaccess, and I decided to go with shorter version of adorr.net without www
Below is how the first part of my .htaccess
* Remember to replace adorr.net with your own domain!
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.adorr.net$ [NC]
RewriteRule ^(.*)$ http://adorr.net/$1 [L,R=301]
Do note that the code above is to rewrite all requests of www.adorr.net to adorr.net.
If you want it to be the other way round, use the following .htaccess instead
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^adorr.net$ [NC]
RewriteRule ^(.*)$ http://www.adorr.net/$1 [L,R=301]
Cheers!
Got anything to say? Go ahead and leave a comment!
Archives
- May 2012
- March 2012
- February 2012
- July 2011
- June 2011
- May 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- March 2010
- February 2010
- January 2010
- December 2009
- September 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008



Posted under: