【问题标题】:Where to place <httpProtocol> in IIS Server web.config file在 IIS 服务器 web.config 文件中放置 <httpProtocol> 的位置
【发布时间】:2015-09-10 07:48:28
【问题描述】:

我目前在 IIS 服务器上的 Wordpress 根目录中有默认的 web.config 文件。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
  <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
            <match url="*"/>
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
            <action type="Rewrite" url="index.php"/>
        </rule></rules>
</rewrite>
</system.webServer>
</configuration>

但是,我想在其中添加以下几行,但我不确定在哪里添加它们:

<httpProtocol>
  <customHeaders>
    <add name="X-UA-Compatible" value="IE=9; IE=10; IE=11" />
  </customHeaders>
</httpProtocol>

这用于在 IE 兼容模式下显示网站。

非常感谢。

【问题讨论】:

    标签: xml windows wordpress iis


    【解决方案1】:

    你应该把它放在文件的system.webServer节点下:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
              <rules>
                <rule name="wordpress" patternSyntax="Wildcard">
                    <match url="*"/>
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                        </conditions>
                    <action type="Rewrite" url="index.php"/>
                </rule>
              </rules>
            </rewrite>
            <!-- PUT IT HERE -->
            <httpProtocol>
              <customHeaders>
                <add name="X-UA-Compatible" value="IE=9; IE=10; IE=11" />
              </customHeaders>
            </httpProtocol>
        </system.webServer>
    </configuration>
    

    【讨论】:

    • 啊,好像做到了。非常感谢您的帮助。
    • 没有问题,你能把答案标记为正确吗?谢谢。
    猜你喜欢
    • 2012-01-08
    • 2014-08-13
    • 2010-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多