Apache 301 redirection from one domain to another
- by Sebastien Lachance
I'm trying to set a redirection in my VirtualHost configuration for my website. So far I am able to redirect non www trafficto the www address like this :
<VirtualHost: *:80>
ServerAlias www.gcbeauce.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^guidedescommercesdebeauce\.com$ [NC]
RewriteRule ^(.*)$ http://www.guidedescommercesdebeauce.com$1 [R=301,L]
But what I also want is to redirect the old domain to this new one. I have tried adding :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^guidedescommercesdebeauce\.com$ [NC]
RewriteCond %{HTTP_HOST} ^gcbeauce\.com$ [NC]
RewriteRule ^(.*)$ http://www.guidedescommercesdebeauce.com$1 [R=301,L]
But nothing happens.
Am I missing something here?