我反向代理一个网站到另一个网站。 它工作的很好,但在一些链接上显示原始链接。 这是我的configuration
原始网站“mysite.com”
在“mysite.com”上提供的第二个站点configuration
<VirtualHost *:80> ServerName test.mysite.com ServerAlias www.test.mysite.com test.mysite.com ErrorLog /var/log/apache2/test.mysite_log.log TransferLog /var/log/apache2/test.mysite-access_log.log LogLevel info LogFormat "%h %l %u %t \"%r\" %>s %b %T" common ProxyPass / http://mysite.com/ ProxyPass / http://mysite.com/ ProxyPassReverse / http://mysite.com/ </VirtualHost>
现在,一切运转良好,但问题是,当我去某个特定的链接redirect到原来的链接。 例如,我的页面上有两个部分:“关于我们”和“查询”。 当我点击“关于我们”,我需要“ http://test.mysite.com/about-us ”,这是可以的
当我点击“查询”时,我要“ http://mysite.com/inquiry ”这是不正确的,它必须是“ http://test.mysite.com/inquiry ”。
我想我已经错过了一些要添加到configuration文件中的东西,但我无法弄清楚。
ProxyPassReverse仅重写HTTP标头。 它与原始网页内的完整url无关。
你可能想要使用第三方模块 – 比如mod_proxy_html 。