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