Monday, May 14, 2012

Use .htaccess to remove www

If you want to have your domain without www, you should consider using htaccess 301 redirection. Using htaccess to remove www is quickest way to setup your domain having unique address, and redirecting users to a non-www address. To achieve this use:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

1 comment: