简体   繁体   English

301的IIS 7.5 UrlRewrite规则重定向到小写url

[英]IIS 7.5 UrlRewrite rule for 301 redirect to lowercase url

I need a Url-rewrite rule to make a 301-redirect to url in lowercase. 我需要一个URL重写规则以使301重定向到小写的url。 For example http://example.com/CurRENcies/USD should become http://example.com/currencies/usd . 例如, http://example.com/CurRENcies/USD应该变成http://example.com/currencies/usd

I have the following rewrite rule: 我有以下重写规则:

<rule name="LowerCaseRule1" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent"/>
</rule>

How can I do this redirects only for GET requests? 我该如何仅针对GET请求进行重定向?

Try this: 尝试这个:

<rule name="LowerCaseRule1" stopProcessing="true">
<match url="^.*[A-Z]+.*$" ignoreCase="false" />
<conditions>
   <add input="{REQUEST_METHOD}" matchType="Pattern" pattern="GET" ignoreCase="true" />
</conditions>
<action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent"/>
</rule>

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

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