Question

We have two domains, www.aaa.com and www.bbb.com. Both point to the same root directory on the server.

The server has two sub-directories in the root: /abc/ and /xyz/.

If someone types in www.aaa.com/abc/ They should go to /abc/ (like normal)
If someone types in www.aaa.com/xyz/ They should go to /xyz/ (like normal)
** If someone types in www.bbb.com/abc/ They should go to /xyz/ (using the rewrite)
If someone types in www.bbb.com/xyz/ They should go to /xyz/ (like normal)

How do we write that rewrite for the third case above, where it only affects domain www.bbb.com and not www.aaa.com?

Was it helpful?

Solution

You need to use condition and a rule:

RewriteCond %{HTTP:Host} ^www\.bbb\.com$ [NC]
RewriteRule ^abc$ /xyz [NC,L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top