Trying to mask a domain xxx.test.com to point to xxzz.test.com/simple
So we have the following two sample domains:
xxx.test.com
and we want to point that to (same ip) this domain:
xxzz.test.com/yyy
and then when you click on a link like so:
xxx.test.com/bbb
it points to:
xxz开发者_JAVA技巧z.test.com/yyy/bbb
What's the best way to achieve this, DNS, ModRewrite... and how
mod_rewrite
is the way to go here. Use a RewriteCond
to test if you're in the right subdomain (xxx.test.com), then capture any URI and rewrite to xxzz.test.com/yyy/<the-URI>
. If you want to mask the call and both servers are running under the same Apache instance, don't include the [R] flag. If you have two different Apache instances, you'll have to proxy between them using the [P] flag, but that will affect performance.
精彩评论