Reputation: 2459
I have two web-sites: example.com and yyy.com
They both have similar web apps, but on different servers. I want to make Apache redirect all path requests to example.com exactly the same way to yyy.com.
For example:
1. Request: example.com/pages/contacts
Redirects to yyy.com/pages/contacts
2. Request: example.com/search?first_val=45&second_val=45
Redirects to yyy.com/search?first_val=45&second_val=45
So, is there any way to make such .htaccess
file? And if yes, how do I do this?
Upvotes: 2
Views: 778
Reputation: 5198
Try something like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ http://www.yyy.com/$1 [R=301,L]
Upvotes: 3