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

标签 xml windows wordpress iis

我目前在 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>

关于xml - 在 IIS 服务器 web.config 文件中放置 <httpProtocol> 的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32496066/

相关文章:

html - IE 中的 float 未正确对齐

php - 安装SSL证书后,WordPress网站仍然不安全。如何更新Google字体网址

java - 循环xml并持久化到数据库java

python - 是否有任何库支持 Python 中的 MTOM 加密

C++ [链接器错误] 未定义对 `performComputation(char, double)' 的引用

windows - 如何在 Windows 7 企业版上使用 Jenkins CI 服务器设置 karma?

python - 解析 ad-hoc 树

c# - 在 C# 代码中解析(大)XML 的最佳方法是什么?

c++ - 在我的 C++ 程序中使用 OpenStreetMap

php - 仅显示三级 Wordpress 菜单