IIS忽略重写规则

时间:2015-04-29 09:20:43

标签: iis web-config rewrite

我有以下web.config。我认为我没有任何问题,但我无法将其重写为索引。我也尝试过url =" index.php"没有领先/

我的web.config有什么问题吗?或者还有其他任何错误(如IIS设置) - 如果是这样,是否可以检查而无需访问服务器(FTP除了页面)?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <configSections>
        <sectionGroup name="system.webServer">
            <sectionGroup name="rewrite">
                <section name="rewriteMaps" overrideModeDefault="Allow" />
                <section name="rules" overrideModeDefault="Allow" />
            </sectionGroup>
        </sectionGroup>
    </configSections>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="NWCMS" stopProcessing="true">
                    <match url=".*" />
                    <action type="Rewrite" url="/index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

1 个答案:

答案 0 :(得分:0)

我认为你想在打开没有文件名的URL时制作index.php默认文件。试试这个:

<?xml version="1.0"?>
    <configuration>
       <system.webServer>
          <defaultDocument enabled="true">
             <files>                      
                <add value="index.php"/> 
             </files>
          </defaultDocument>
          <modules runAllManagedModulesForAllRequests="true"/>
       </system.webServer>
    </configuration>