문제

I have a rewrite rule that converts a URL to lowercase. I would like to exclude a folder but don't know RegEx. How do I exclude "~/myfolder" from the rule below?

  <rewrite>
        <rules>
            <rule name="LowerCaseRule1" stopProcessing="true">
                <match url="[A-Z]" ignoreCase="false" />
                <action type="Redirect" url="{ToLower:{URL}}" />
            </rule>
        </rules>
    </rewrite>
도움이 되었습니까?

해결책

You could do something such as:

    <rules>
        <rule name="LowerCaseRule1" stopProcessing="true">
            <match url="[A-Z]" ignoreCase="false" />
             <conditions>
              <add input="{URL}" negate="true" pattern="^~/myfolder$" />
             </conditions>
            <action type="Redirect" url="{ToLower:{URL}}" />
        </rule>
    </rules>

or... you could create another rule that does essentially the opposite for the specific match:

    <rules>
        <rule name="LowerCaseRule2" stopProcessing="false">
            <match url="^~/myfolder$" ignoreCase="true" />
            <action type="None" />
        </rule>
    </rules>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top