Search code examples
apache.htaccessiisweb-config

Convert htaccess RewriteCond to web.config


What's the converted/translation of this piece of code from htaccess to web.config?

Options +SymLinksIfOwnerMatch 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [L]

Solution

  • Ok, I think found the answer :

        <rule name="Remove trailing slash" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
            </conditions>
            <action type="Rewrite" url="index.html" />
        </rule>