【问题标题】:IIS ignoring rewrite rulesIIS 忽略重写规则
【发布时间】:2015-07-03 23:09:21
【问题描述】:

我有以下 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】:

    我认为您希望在打开没有文件名的 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>
    

    【讨论】:

      猜你喜欢
      • 2018-11-13
      • 1970-01-01
      • 2014-11-30
      • 2017-07-25
      • 2013-09-27
      • 1970-01-01
      • 2011-06-14
      • 2019-03-13
      • 2017-04-29
      相关资源
      最近更新 更多