Remove www From URL using .htaccess in Apache
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]