繁体   English   中英

在IIS服务器web.config文件中放置<httpProtocol>的位置

[英]Where to place <httpProtocol> in IIS Server web.config file

我目前在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兼容模式下显示网站。

非常感谢。

您应该将它放在文件的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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM