How to Set Up a Redirect for the ads.txt File

To enable delegation of the ads.txt file, you need to configure an HTTP redirect from https://%domain%/ads.txt to https://adstxt.clickio.com/%domain%/ads.txt. Only a single redirect is allowed. Follow the steps below to set this up for your website.

Important: Enable the /ads.txt redirect only after Ads.txt delegation is enabled in the Clickio platform for your domain. If delegation is not enabled in Clickio, do not configure the redirect yet, as it may point to an inactive or incorrect destination.

1. What Does %domain% Mean and Where to Get It

The placeholder %domain% refers to your website's domain, which is required to set up the redirect properly. You can find the correct value of %domain% by logging into the Clickio platform and navigating to Ads.txt > Ads.txt delegation > Redirect. The platform will display the exact domain format that needs to be used for delegation.

For example, if the platform shows example.com, you would replace %domain% with example.com.

2. Setting Up the Redirect on Your Web Server

Apache (using .htaccess):

If your website is hosted on an Apache server, you can set up the redirect by modifying the .htaccess file.

  1. Access the .htaccess file via FTP or your hosting control panel.

  2. Add the following rule to create a 301 redirect:

    RewriteEngine On
    RewriteRule ^ads\.txt$ https://adstxt.clickio.com/%domain%/ads.txt [R=301,L]

This will redirect the ads.txt file to the specified URL.

Nginx:

For Nginx users, you can configure the redirect in the server configuration file.

  1. Open the Nginx configuration file for your domain.

  2. Add the following location block:

    location = /ads.txt {
    return 301 https://adstxt.clickio.com/%domain%/ads.txt;
    }
  3. Save and reload Nginx for the changes to take effect.

3. Setting Up the Redirect via Hosting Control Panel

Many hosting providers, such as cPanel or Plesk, allow setting up redirects directly through their control panel.

  1. Log in to your hosting provider's control panel.
  2. Navigate to the Redirects section.
  3. Set up a Permanent (301) redirect from %domain%/ads.txt to https://adstxt.clickio.com/%domain%/ads.txt.
  4. Save the settings to apply the redirect.

In some hosting environments, the Redirects interface may be disabled by the provider (via Feature Manager), so it may not be available in your cPanel. Also, existing redirects cannot be edited in place — to change a redirect, you must delete it and create a new one.

4. Setting Up the Redirect with Cloudflare

For users with Cloudflare DNS management, you can set up the redirect using Page Rules.

  1. Log in to your Cloudflare account and select your domain.
  2. Go to the Page Rules section.
  3. Create a new Page Rule:
    • URL: https://%domain%/ads.txt
    • Action: Redirect Rules (Single Redirects)
    • Destination: https://adstxt.clickio.com/%domain%/ads.txt
  4. Save the rule to activate the redirect.

Important: For Cloudflare redirects to work (Page Rules or Redirect Rules), the hostname in the source URL must be proxied through Cloudflare (orange cloud enabled in DNS). If the DNS record is set to DNS only (gray cloud), the redirect rule will not be applied.

Important: In Cloudflare, Single Redirects are evaluated before Page Rules. If both match the same request, the Single Redirect takes precedence and the Page Rule may not run. Make sure there are no overlapping redirect rules for /ads.txt.

Important Notes:

  • Only a single HTTP redirect is allowed for the ads.txt file when delegating to a third-party domain (e.g., adstxt.clickio.com). If the target URL issues another redirect to a different domain, the system will treat it as an error.
  • Multiple redirects are valid as long as each redirect remains within the same root domain. For example, a redirect from http://%domain%/ads.txt to https://%domain%/ads.txt is allowed.
  • Always use a 301 (permanent) redirect to ensure proper delegation.
  • After configuring the redirect, verify its correctness by visiting %domain%/ads.txt and confirming the redirection to https://adstxt.clickio.com/%domain%/ads.txt.

For more information, you can refer to the official IAB ads.txt specification.