简体   繁体   中英

301 redirection - Trailing Slash web.config

I want to do permanent 301 redirect from http://www.example.com/ to http://www.example.com .

I had tried below code in web.config, but not working. 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>

You don't need to redirect the root domain, read this

http://googlewebmastercentral.blogspot.co.il/2010/04/to-slash-or-not-to-slash.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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