如何仅在特定文件iis10上的网址栏中删除扩展名

时间:2018-11-20 22:33:01

标签: iis url-rewriting iis-10

我想从url重写中排除文件,因为url ruite在url上工作正常,但是由于“ GET site.com/php/activeusers net :: ERR_TOO_MANY_REDIRECTS”,我的ajax调用不起作用,是否有人解决此问题的方法还是从url重试中排除文件的方法?

我使用的示例ajax请求:

$.ajax({
        method: "POST",
        data: GetAllMessages,
        url: "php/functions.php",
        success: function (msg) {
            if (msg !== "Success") {
                console.log(msg);
            }
        }
    })

和我的重载网址规则:

<rewrite>
            <rules>
                <rule name="Hide .php ext">
                    <match ignoreCase="true" url="^(.*)"/>
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                        <add input="{REQUEST_FILENAME}.php" matchType="IsFile"/>
                    </conditions>
                    <action type="Rewrite" url="{R:0}.php"/>
                </rule>
                <rule name="Redirecting .php ext" stopProcessing="true">
                    <match url="^(.*).php"/>
                    <conditions logicalGrouping="MatchAny">
                        <add input="{URL}" pattern="(.*).php"/>
                    </conditions>
                    <action type="Redirect" url="{R:1}"/>
                </rule>
                <rule name="LowerCaseURL" stopProcessing="true">
                    <match url="[A-Z]" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_X_Requested_With}" pattern="^XMLHttpRequest$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="{ToLower:{URL}}" />
                </rule>
            </rules>
        </rewrite>

0 个答案:

没有答案