Page 1 of 1

Remove www for urls

Posted: Sat Feb 21, 2015 9:33 am
by dananimal
What is the correct way in vestcp to redirect requests for www.example.com to example.com?

Re: Remove www for urls

Posted: Sat Feb 21, 2015 9:47 am
by patstan
You can use .htaccess

Re: Remove www for urls

Posted: Sun Feb 22, 2015 7:49 am
by dananimal
Thanks, that's perfect.

If anyone else needs to do this in .htaccess in the web root directory:

Code: Select all

RewriteEngine on
# remove 'www.' from URLs
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]