简体   繁体   English

带有参数的URL的IIS URL重写301重定向不起作用

[英]IIS URL Rewrite 301 Redirect for urls with parameters doesn't work

I have following rule for 301 redirects: 对于301重定向,我有以下规则:

<rule name="301RedirectsRule" enabled="true" stopProcessing="true">
  <match url=".*" />
    <conditions logicalGrouping="MatchAll">
       <add input="{301Redirects:{URL}}" pattern="(.+)" />
    </conditions>
    <action type="Redirect" url="{C:1}" redirectType="Permanent" />
</rule>

In rewrite map there are rules: 在重写map中有一些规则:

<add key="/di/web/home/Glossary/index.aspx" value="/resources/dental-terminology" />
<add key="/di/web/knowledge-base/article.aspx?id=62" value="/resources/oral-pathology/oral-conditions-and-diseases/periodontal-disease" />

First one works perfectly, but any URL with parameter (like second one) doesn't work. 第一个完美地工作,但是任何带有参数的URL(例如第二个)都不起作用。

I'm not entirely up to speed with the IIS rewrite module, but you could try to replace {301Redirects:{URL}} with {301Redirects:{REQUEST_URI}} . 我不完全了解IIS重写模块,但是您可以尝试将{301Redirects:{URL}}替换为{301Redirects:{REQUEST_URI}}

I believe the first one does not contain the query string. 我相信第一个不包含查询字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM