Reputation: 787
I want to redirect .domain.com/ to .otherdomain.com/ and domain.com/* to otherdomain.com/* which is on the other server.
Also, I want the address bar to change to the new domain
eg: hi.domain.com/there -> hi.otherdomain.com/there
I found some examples of .htaccess but cannot make both rules in one.
How can I do that?
Thanks!
Upvotes: 0
Views: 415
Reputation: 24478
You can try this in your .htaccess in the root.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+\.)?domain\.com$
RewriteRule ^(.*)$ http://%1otherdomain.com/$1 [R=301,L]
Upvotes: 1