If you have a lot of links on the web where people are linking to your site as www.example.com, but you would like your visitors to instead end up at example.com you can force this version of your domain with these rules:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]
Most Popular Articles
Setting Up a Permanent 301 Redirect in .htaccess ?
A permanent 301 redirect in your .htaccess file lets search engines and others know that an old...
Redirect an old domain to a new domain ?
Redirect an old domain to a new domainIf you had an old domain such as example.com, and now you...
Redirect all files with certain extension
Redirect all files with certain extensionTo re-direct all of one type of file to another, such as...
How to Redirect to a Mobile Version of your Website
If you've created a mobile version of your website, you'll need to be sure that you redirect your...
Redirecting visitors to an Under Construction page
When working on your website, you may want to prevent any visitor from accessing your site except...
