I want to remove "www" from my domain at apache2.
I tryed out lots of examples whiches do it with an .htaccess
file but none of them works.
So here's my .htacces
which is owned by user root with chmod 644:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC]
RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]
This is not removing the www and if I type EDIT: It was browser's fail, but prev. problem exists.http://your-site.com
in my browser (Firefox) it redirects me to www.your-domain.com
stil.
My apache2 is setted up for this main domain without www.
already and that was my all .htaccess.
The easy solution I use from No WWW, Better SEO is to start each .htaccess with the following:
RewriteEngine On
RewriteBase /
# FROM www. --TO-- NO www.
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
This is just a cut and paste no brainer. It is the first thing on each .htaccess I have on hundreds of sites and domains.