7
votes

I've hit a bit of a problem with creating an ads.txt file. I'm working with an advertiser, and they would like to host the ads.txt file so they can easily make changes to it.

Is it possible to set up a redirect in at

mysite.com/ads.txt 

which points to something like

theirsite.com/mysite/ads.txt 

If so, what would be the code to you in mysite.com/ads.txt to make the redirect work?

3

3 Answers

3
votes

For those looking, I did eventually find a solution to this by editing the following line into the .htaccess (you'll need to alter the path for your own link):

RewriteRule ^ads\.txt$ "https\:\/\/theirsite\.com\/clients\/folder\/ads\.txt" [R=301,L]
3
votes

Per IAB's ads.txt Specification 1.0.1 (September 2017), section 3.1 "ACCESS METHOD",

Only a single HTTP redirect to a destination outside the original root domain is allowed to facilitate one-hop delegation of authority to a third party's web server domain.

So you should be fine with a single redirection from mysite.com/ads.txt >> theirsite.com/mysite/ads.txt.

2
votes

It is possible with restriction. You can use redirects, as many as you want within the scope of the original root domain, which is not the fact in your situation. For a third party domain the restriction is that only a single redirect is allowed. You should check if this is the fact for your advertisers ads.txt url.

Another possible solution is: Crawl the advertisers ads.txt and put it in your specific folder once or twice a day.

See the specification:

https://iabtechlab.com/wp-content/uploads/2017/09/IABOpenRTB_Ads.txt_Public_Spec_V1-0-1.pdf

If the server response indicates an HTTP/HTTPS redirect (301, 302, 307 status codes), the advertising system should follow the redirect and consume the data as authoritative for the source of the redirect, if and only if the redirect is within scope of the original root domain as defined above. Multiple redirects are valid as long as each redirect location remains within the original root domain. For example an HTTP to HTTPS redirect within the same root domain is valid.

Only a single HTTP redirect to a destination outside the original root domain is allowed to facilitate one-hop delegation of authority to a third party's web server domain. If the third party location returns a redirect, then the advertising system should treat the response as an error. A future version may address other delegation of authority to a third-party web server. Any other redirect should be interpreted as an error and ignored.