How does one use the built in IIS URL Rewrite SEO rule that adds trailing slash only to files that exist?
        Posted  
        
            by 
                Sn3akyP3t3
            
        on Pro Webmasters
        
        See other posts from Pro Webmasters
        
            or by Sn3akyP3t3
        
        
        
        Published on 2012-06-28T17:57:14Z
        Indexed on 
            2012/06/28
            21:25 UTC
        
        
        Read the original article
        Hit count: 533
        
url-rewriting
|iis7
The default rule template is AddTrailingSlash. I've added another condition that allows the rule to apply to directories and not files, but I'm not sure if this is industry standard.
Added:

The rule allows for filename that are not standard such as .mobileconfig
The web.config contains this rule when the template is applied:
<rule name="AddTrailingSlashRule1" enabled="true" stopProcessing="true">
          <match url="(.*[^/])$" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" pattern="^.*\.[a-z]{1,12}" negate="true" />
          </conditions>
          <action type="Redirect" url="{R:1}/" />
</rule>
        © Pro Webmasters or respective owner