This section expands our ads.txt setup article to cover steps on setting up a 301 redirect for Windows (IIS) web servers.

  • Ensure the rewrite module is installed (see here for Microsoft’s documentation)

  • Open web.config in the root of your site

  • Add the following configuration in the file, replace #### with the ID of your property, found in your site list in the NitroPay panel.

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="NitroPay">
          <match url="ads\.txt" />
          <action type="Redirect" redirectType="Permanent" url="https://api.nitropay.com/v1/ads-####.txt" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
  • Save the file, build and deploy your website.

  • Test that the redirect works by going to yourdomain.com/ads.txt and noting that the URL and contents changed to the hosted ads.txt.

Did this answer your question?