Reputation: 1
I have got a domain called www.domain.nl I want to redirect www.domain.nl to newdomain.com/new all other urls from domain.nl for example www.domain.nl/old/ should redirect to www.newdomain.com/old/
and of course I want google to preserve my ranking (301)
Can anyone tell me what my htaccess file looks like.
thanks
Upvotes: 0
Views: 27
Reputation: 9323
RewriteCond ${HTTP_HOST} domain.nl RewriteRule ^$ http://newdomain.com/ [R=301,L,QSA]
RewriteCond ${HTTP_HOST} domain.nl RewriteRule ^(.*)$ http://newdomain.com/old$1 [R=301,L,QSA]
(Untested)
Upvotes: 0
Reputation: 785156
Put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.nl$ [NC]
RewriteRule ^$ http://newdomain.com/new [L,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.nl$ [NC]
RewriteRule ^(.+)$ http://newdomain.com/$1 [L,R=301]
Upvotes: 1