How to Fix Google AdSense "ads.txt Not Found" Warnings
Google AdSense flags 'ads.txt not found' when https://yourdomain.com/ads.txt returns 404, redirects to /login behind auth middleware, sits only on a www subdomain, or serves an HTML error page instead of plain text publisher records.
Why Does This Issue Occur? (Symptom & Cause Matrix)
| Observed Symptom | Root Technical Cause | Recommended Fix |
|---|---|---|
| ads.txt redirects to /login (307) | App authentication middleware intercepts /ads.txt | Whitelist /ads.txt in middleware.ts to serve HTTP 200 text/plain |
| File uploaded inside /blog instead of root | Wrong directory path | Serve strictly at root https://yourdomain.com/ads.txt (public/ads.txt) |
Step-by-Step Fix Checklist
- 1
Place ads.txt in Webroot / public/ Directory
Create public/ads.txt (Next.js) or webroot /ads.txt (Hostinger/WordPress) containing: google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0.
- 2
Bypass Auth Middleware & Bot Challenges
Ensure auth middleware and Cloudflare WAF return raw HTTP 200 text/plain without login redirects.
- 3
Verify Live via curl -i
Confirm Content-Type: text/plain and exact publisher ID output before clicking Verify in AdSense.
Exact Google AdSense ads.txt Record Format
google.com, pub-4109344249041101, DIRECT, f08c47fec0942fa0People Also Ask About This Error
How long does AdSense take to recognize a newly added ads.txt?
Once /ads.txt returns HTTP 200 text/plain publicly, clicking Verify triggers re-crawling within minutes to 24 hours.
Should robots.txt disallow ads.txt?
Never—disallow rules block Google's Mediapartners-Google and AdSense verification bots from reading ads.txt.