Allot of outdated websites still use www. in their urls, however did you know this is very outdated behaviour invented way back when the internet first started? The whole idea of using www. was invented so that anyone seeing a URL would instantly know it was a URL as www stands for World Wide Web. However www is in fact a sub-domain just like when you might setup shop.mywebsite.com, and its use in todays world does not make sense, as everyone can now distinguish a URL from any other piece of information. Even more serious is that a number of websites allow for the user to browse to www.mywebsite.com, or just mywebsite.com - which presents a serious site duplication problem for search engines! So ultimately you will need to decide whether you want to force the www. on your website or not, and this article will show you how to remove www from your urls - personally I think urls like far cleaner without the www and technically if you use www your site is a sub domain which is nonsensical.
Force removal of www from URL:
Here is the code snippet:
RewriteEngine On # Force NO www RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Why do either?
It is important that you force one method or the other, as allowing for either could cause problems and inconsistency's. A few important benefits include:
- It will avoid duplicate content problems with search engines such as Google.
- It will avoid the possibility of split page ranking and/or missing rankings.
- It is nicer and more consistent for you and your visitors.





