How To Fix missing Ads.txt File
In our case, Google was incorrectly reporting that websites were missing ads.txt file.
For months, the “Earning at risk” message showed in Adsense for some of our busiest websites. The message would sometimes disappear for a website, only to re-appear.
Each time we checked the ads.txt file was definitely there, in the correct location (public_html) but still we see..
Earnings at risk – You need to fix some ads.txt file issues to avoid severe impact to your revenue.
FIX – MISSING ADS.TXT FILE
In 2020, we discovered Google looks for the file (ads.txt) in the root without www.
The root of our websites is: https://www.example.com/ads.txt (not https://example.com/ads.txt).
We added this code to .htaccess file and a few days later the number went from 17 missing files to 0.
This code redirects the user from without www to with wwww.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
Download the code
- code-htaccess-rewrite (Notepad)
Google has a help page and a Troubleshooting ads.txt issues page.
Google = 3 issues and fixes
- Your site doesn’t have an ads.txt file – download and add it
- Your publisher ID is missing from your ads.txt file. – Copy your publisher ID and add it to your ads.txt file
- You’ve uploaded your ads.txt but AdSense still says you need to create one. – Please wait a few days (up to a month).
To verify that you published your file correctly, check access the ads.txt URL (https://example.com/ads.txt) in your web browser.