Quantcast
Viewing all articles
Browse latest Browse all 49209

non-www to www redirects on a Mercury multi-site VPS

We have a mercury server setup on VPS.net that is using multi-site to run multiple sites using the same Pressflow install. We recently ran into a problem with implementing our non-www to www canonical domain redirects. In the past we were able to uncomment the section of the .htaccess file included by Drupal to do these redirects because we were not using multi-site. Now that we are using multi-site we have tried to implement the redirects using apache vhosts but the redirect never seems to happen and it appears to be some kind of interference from Varnish that is keeping it from working. When I visit example.com:8080 I will get redirected to www.example.com but when I visit example.com it never redirects. Does varnish follow the redirect internally and not redirect the user, perhaps? Do we need to implement these redirects in the varnish .vcl file? If we have to do the redirect in the .vcl file how can we prevent Bcfg2 from overwriting our changes? If you have any ideas for us, please let us know. Here is an example vhost that we have setup that is not redirecting properly:

<VirtualHost xxx.xxx.xxx.xxx:8080>
DocumentRoot /var/www
ServerName www.example.com
ServerAlias example.com

RewriteEngine on
RewriteCond %{HTTP_HOST} !=www.example.com
RewriteCond %{HTTP_HOST} !=""
RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L]

Viewing all articles
Browse latest Browse all 49209

Trending Articles