所以我有一个简单的问题,但不知何故似乎不起作用。我有一个 URL http://www.domain.com/%20#axzz2ZX4J0KAS
,我想将其重定向到 http://www.domain.com/page-name.htm
。我在 IIS URL Rewrite/web.config 中尝试了很多组合,它们似乎都可以在测试模式对话框中工作,但在浏览器中都不起作用。
1.
<rule name="Redirect%20InHomePage" enabled="true" stopProcessing="true">
<match url="^(.+)domain\.com/(\s|%20)(.+)" ignoreCase="true" />
<action type="Redirect" url="http://www.domain.com/page-name.htm" />
</rule>
2.
<match url="(.+)/%20(.+)" ignoreCase="true" />
3.
<match url="(.+)domain.com/ (.+)" ignoreCase="true" />
4.
<match url="(.+)domain.com/(\s|%20)(.+)" ignoreCase="true" />
如您所见,我尝试了上述所有模式,它们在测试模式对话框中都运行良好,但当我浏览 URL 时,它总是将 %20 转换为空格,并且规则不适用于重定向。
如果有人知道我错过了什么,请帮助我解决这个简单但尚未解决的问题。
最佳答案
关于asp.net - IIS 重定向正则表达式不适用于空格 - URL 中的 %20,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17756957/