I want that a url of the form
http://www.example.com
redirects to
example.com
How can I achive this? I found that .htaccess Remove WWW from URL + Directories comes pretty close to my question, but I do not know how to change it appropriately.
I want that a url of the form
http://www.example.com
redirects to
example.com
How can I achive this? I found that .htaccess Remove WWW from URL + Directories comes pretty close to my question, but I do not know how to change it appropriately.
To remove www ,you can use :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^ http://%1%{REQUEST_URI} [NE,L,R]
or
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [NE,L,R]