Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I currently have the default web.config file in the root directory of Wordpress on an IIS Server.

<?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>

However, I would like to add the following lines in there but I'm not sure where to add them in:

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

This is used to display the website in IE compatibility mode.

Many thanks.

like image 690
virs90 Avatar asked Sep 10 '15 07:09

virs90


1 Answers

You should put it under the system.webServer node of the file:

<?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>
like image 172
Celt Avatar answered Nov 20 '22 12:11

Celt