Remove www From URL using .htaccess in Apache
Tagged with: apache, Code, htaccess, mod_rewrite, remove, www
Saturday, September 6th, 2008 11:16 PM
This htaccess code will remove the ‘www’ part from the url. It uses the mod_rewrite module of apache to re-write the url - so make sure that’s installed.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]