Apache 301 redirection from one domain to another
Posted
by
Sebastien Lachance
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Sebastien Lachance
Published on 2011-02-01T15:41:27Z
Indexed on
2011/02/02
7:32 UTC
Read the original article
Hit count: 283
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?
© Ask Ubuntu or respective owner