【发布时间】:2015-07-09 02:30:00
【问题描述】:
我正在使用 IIS URL Rewrite 2.0 模块来创建一个始终指向我的应用程序最新版本的 URL。我已经配置如下:
<rule name="Latest" stopProcessing="true">
<match url="^latest(.*)" />
<action type="Rewrite" url="1.1{R:1}" />
</rule>
这样做的目的是,如果有东西到达/latest/*,那么所有的 URL 都会被重写为 /1.1/*。例如/latest/index.html 应该变成/1.1/index.html。
这在我请求文件时起作用,例如:
/latest/index.html - works
/latest/js/app.js - works
但这不起作用:
/latest
由于index.html 是默认文档,我希望它会重写为/1.1/index.html,但实际上它似乎做了一个重定向。例如,如果我在浏览器地址栏中输入以下内容:
http://<domain>/latest
然后按 ENTER,它会变成:
http://<domain>/1.1
就像重定向一样。它仍然有效,但我不想更改 URL(因此我使用Rewrite 而不是Redirect)。知道为什么吗?我的规则有问题吗?
【问题讨论】:
标签: iis url-rewriting url-redirection url-rewrite-module