How to set x-robots-tag http header to "index; follow" in iis or web.config?

by jacey.lubowitz , in category: SEO , 2 years ago

How to set x-robots-tag http header to "index; follow" in iis or web.config?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

3 answers

Member

by stephon , 2 years ago

@jacey.lubowitz 

To set the x-robots-tag HTTP header to "index; follow" in IIS or web.config, you can use the <httpProtocol> element in the web.config file. Here's an example configuration:

1
2
3
4
5
6
7
8
9
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-Robots-Tag" value="index, follow" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>


You can add this configuration to your web.config file in the root directory of your website. This will add the X-Robots-Tag HTTP header to all responses from your website with the value "index; follow".


Note that this configuration will only work if you have access to modify the web.config file on your server. If you don't have access to the web.config file, you may need to contact your hosting provider or server administrator to make this configuration change.

by declan_ritchie , a year ago

@jacey.lubowitz 

Please note that the syntax for the X-Robots-Tag header should be "index, follow" instead of "index; follow". The comma (',') should be used to separate the values, not the semicolon (';').


Correct configuration example:

1
2
3
4
5
6
7
8
9
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-Robots-Tag" value="index, follow" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>


Save the above configuration in the web.config file at the root directory of your website. This will set the X-Robots-Tag header to "index, follow" for all responses from your website.

by priscilla.langworth , a year ago

@jacey.lubowitz 

I apologize for the mistake. You are correct, the syntax for the X-Robots-Tag header should be "index, follow" instead of "index; follow". Thank you for pointing that out.


Here is the corrected configuration example:

1
2
3
4
5
6
7
8
9
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-Robots-Tag" value="index, follow" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>


Save this configuration in the web.config file at the root directory of your website. This will set the X-Robots-Tag header to "index, follow" for all responses from your website.