【发布时间】:2012-04-23 15:54:59
【问题描述】:
好的,我发现了一些与非常相似的问题相关的主题,但使用为我自己的网站提供的答案没有任何运气。基本上我有 2 个站点,映射如下:
/public_html/ - points to main domain (www.site1.com)
/public_html/site2.com - points to secondary domain (www.site2.com)
/public_html/portal - points to my target subdirectory
我正在尝试获取对 www.site2.com/portal 的所有请求以透明地加载 www.site1.com/portal,也就是说,我仍然希望 www.site2.com/portal 显示在地址栏中。
RewriteCond %{HTTP_HOST} ^(www\.)?site2\.com [NC]
RewriteCond %{REQUEST_URI} ^/portal/(.*)$
RewriteRule ^/(.*) /portal/$1 [L]
根本没用
RewriteCond %{HTTP_HOST} ^(www\.)?site2\.com$ [NC]
RewriteCond %{REQUEST_URI} ^/portal/(.*)$
RewriteRule ^(.*)$ http://site1.com/portal/$1 [L]
带我去http://site1.com/portal/site2.com/portal。
这几天我一直在用头撞墙,任何帮助将不胜感激!
【问题讨论】:
-
好的,#anubhava 显然有我需要的解决方案,如果我采用他的第一个解决方案并将代理标志更改为重定向标志,它可以完美运行,所以显然这是一个服务器配置问题
标签: .htaccess mod-rewrite