重定向到另一个域名,但保留网址 [英] redirect to another domain, but keep the url
问题描述
我有2个虚拟主机:www.example1.com和www.example2.com
I have 2 vhosts: www.example1.com and www.example2.com
我有一个www.example1.com/page.html页
I have a page on www.example1.com/page.html
我想此页面可以访问其他域中,这意味着我希望人们能够得到www.example2.com/page.html~~V并查看该页面是物理上的其他虚拟主机。但是,URL必须显示www.example2.com
I want this page to be accessible in the other domain, meaning I want people to be able to get to www.example2.com/page.html and view that page that is physically on the other vhost. But the URL must display www.example2.com
我不想简单地物理移动的页面到其他的虚拟主机,因为它是一个字preSS页面,这将是一个巨大的麻烦。
I don't want to simply move the page physically to the other vhost, because it is a wordpress page and it would be a huge hassle.
这可能吗?
推荐答案
有两种选择:
- 使用的Apache的ProxyPass: http://httpd.apache.org/文档/ 2.2 / MOD / mod_proxy.html#的ProxyPass
-
使用与[P]标志重写(需要安装mod_proxy的)
- Use Apache ProxyPass: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass
Use Rewrite with [P] flag (requires mod_proxy installed)
重写规则/(.*)$ http://example2.com/ $ 1 [P]
RewriteRule /(.*)$ http://example2.com/$1 [P]
http://httpd.apache.org/docs/2.4/rewrite/ flags.html
这篇关于重定向到另一个域名,但保留网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!