Php URL重写(IIS)中断内部重定向

Php URL重写(IIS)中断内部重定向,php,redirect,mod-rewrite,Php,Redirect,Mod Rewrite,我根据这个视频设置了htm/html/php重写和重定向,它工作得非常好,只是它会导致我的php联系人表单在提交时中断。在没有重写/重定向的情况下,表单被提交,页面被重定向(通过action=“index.php”)到index.php,然后我通过“header”(位置:demo.php)将其重定向回联系人页面(demo.php)。启用重定向/重写后,页面重定向到“index”“然后表单永远不会提交,也不会重定向到demo.php。要解决此问题,我需要修改哪些设置 my web.config文件

我根据这个视频设置了htm/html/php重写和重定向,它工作得非常好,只是它会导致我的php联系人表单在提交时中断。在没有重写/重定向的情况下,表单被提交,页面被重定向(通过action=“index.php”)到index.php,然后我通过“header”(位置:demo.php)将其重定向回联系人页面(demo.php)。启用重定向/重写后,页面重定向到“index”“然后表单永远不会提交,也不会重定向到demo.php。要解决此问题,我需要修改哪些设置

my web.config文件中的重写/重定向规则:

    <rewrite>
<rules> <rule name="Hide .htm ext">
        <match url="^(.*)" ignoreCase="true" />
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_FILENAME}.htm" matchType="IsFile" />
        </conditions>
        <action type="Rewrite" url="{R:0}.htm" />
    </rule>
    <rule name="Redirecting .htm ext" stopProcessing="true">
        <match url="^(.*).htm" />
        <conditions logicalGrouping="MatchAny">
            <add input="{URL}" pattern="(.*).htm" />
        </conditions>
        <action type="Redirect" url="{R:1}" />
    </rule>

    <rule name="Hide .html ext">
        <match url="^(.*)" ignoreCase="true" />
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_FILENAME}.html" matchType="IsFile" />
        </conditions>
        <action type="Rewrite" url="{R:0}.html" />
    </rule>
    <rule name="Redirecting .html ext" stopProcessing="true">
        <match url="^(.*).html" />
        <conditions logicalGrouping="MatchAny">
            <add input="{URL}" pattern="(.*).html" />
        </conditions>
        <action type="Redirect" url="{R:1}" />
    </rule>     

    <rule name="Hide .php ext">
        <match url="^(.*)" ignoreCase="true" />
        <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>
</rules>
</rewrite>

通过将pattern=“(.*).php”更改为pattern=“demo.php”,可以使一切正常工作,尽管这不是一个理想的解决方案,因为它使.php重写/重定向只适用于一个特定页面(即demo.php)