I have a domain called olddomain.com
. Now I want to point the DNS entry to newdomain.com
. Can I then use a .htaccess which determines if the user comes from olddomain.com
and redirects to newdomain.com/path/welcomepage.html
?
I found this and created something like
RewriteCond %{HTTP_HOST} ^http://www.olddomain.com/$ [NC]
RewriteRule ^path/welcomepage.html$ http://www.newdomain.com/$1 [R=301,L]
Would this work (together with pointing the A-record or CName-record on newdomain.com
)?
The redirect should be permanent. So should I use R=permanent,QSA,L like here?
Edit:
Now I tried the lines from Seybsen together with the following CName record:
Typ:
CName record
Name:
www.olddomain.com.
TTL:
3600
Cname: newdomain.com.
But the result is (with and without the redirect) that only a advertisement from the provider of newdomain.com is shown.