IIS忽略重写规则

问题描述 投票:1回答:1

我有以下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>
iis web-config rewrite
1个回答
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>
© www.soinside.com 2019 - 2024. All rights reserved.