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?

Était-ce utile?

La solution

You need to use condition and a rule:

RewriteCond %{HTTP:Host} ^www\.bbb\.com$ [NC]
RewriteRule ^abc$ /xyz [NC,L]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top