【发布时间】:2009-08-19 10:30:10
【问题描述】:
我正在尝试在我的主/根网站上使用ManagedFusion UrlRewriter 模块将具有特定主机名的请求重定向到根的子文件夹。假设我的根名为profkroot.com,它有一个名为cottages 的子文件夹(ASP.NET 应用程序)。我还有一个名为profkcottages.com 的域,我正在尝试将其重定向到profkroot.com/cottages。
使用以下示例规则,我得到了一个完全无聊的重写 URL。我了解规则的正则表达式方面,但我对重写部分的了解不够,而且这变得有点紧迫,所以任何帮助将不胜感激。
这是profkroot.com 上的规则:
重写引擎开启
#Fix missing trailing slash char on folders
RewriteCond %{HTTP:Host} (.*)
RewriteRule ([^.?]+[^.?/]) http\://%1$1/ [R]
#Emulate profkcottages.com
RewriteCond %{HTTP:Host} (?:www\.)?profkcottages\.com
RewriteRule (.*) /cottages$1 [NC,L]
如果我请求http://profcottages/home.aspx,这是重写的网址:
http://profkcottages.com/http/://profkcottages.com/home/.http/://profkcottages.comaspx/
【问题讨论】:
标签: asp.net mod-rewrite url-rewriting