简体   繁体   English

301重定向-尾部斜杠web.config

[英]301 redirection - Trailing Slash web.config

I want to do permanent 301 redirect from http://www.example.com/ to http://www.example.com . 我想从http://www.example.com/http://www.example.com进行永久301重定向。

I had tried below code in web.config, but not working. 我曾尝试在web.config中使用以下代码,但无法正常工作。 Is there anything other changes I have to do? 我还需要做其他更改吗?

<rule name="SEO - Remove trailing slash" stopProcessing="false">
         <match url="(.*)/$" />
         <conditions>
           <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
           <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
         </conditions>
         <action type="Redirect" url="{R:1}" />
       </rule>

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

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