【发布时间】:2012-04-01 00:35:41
【问题描述】:
我有一个功能完善的 URL 重写来删除文件扩展名。但是当我使用response.redirect 时,不会发生 URL 重写。奇怪的是,这只发生在 URL 使用完整路径而不是相对路径时。例如:
response.redirect("http://example.com/page")
给我http://example.com/page.asp
而response.redirect("/page") 很好。
网址重写代码:
<rule name="rewrite asp">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" negate="true" pattern="(.*).asp" />
</conditions>
<action type="Rewrite" url="{R:1}.asp" />
</rule>
我需要使用完整路径,因为我要从一个域转到另一个域。有什么想法吗?
【问题讨论】:
-
doh,对不起,这是 Server.Transfer
-
啊,是的,是的,我试过了,但没有用。
-
作为最后的建议,尝试添加一个查询字符串,例如'response.redirect("example.com/page/?test=1")'
-
这给了我example.com/page.asp?test=1。我认为它必须在接收端,不会触发 URL 重写。
-
我在这个关于重写规则的问题上看不到任何重写规则配置示例,这太奇怪了:/
标签: asp-classic url-rewriting cross-domain