How to Fix “AdSense ads.txt Not Found” Issue in WordPress

AdSense ads txt Not Found

Suppose your AdSense account shows the message “ads.txt file not found” even though you’ve uploaded it correctly. In that case, the problem usually lies in your domain redirection — especially if your site loads on both www and non-www versions.

This guide explains the exact issue and how I fixed it permanently using a simple .htaccess rule on Hostinger hosting.


1. What Is the ads.txt File?

The ads.txt (Authorized Digital Sellers) file is a small text file that tells Google which ad networks are allowed to sell ads on your website.
It should be placed at:

https://yourdomain.com/ads.txt

A correct example:

google.com, pub-xxxxxxxxxxxxxxxx, DIRECT, f08c47fec0942fa0

If AdSense can’t crawl this file, your site won’t show ads until it’s verified.


2. The Real Cause of “ads.txt not found”

In many WordPress setups, the file is uploaded correctly but Google still shows an error.
The most common reason:

The www and non-www versions of your domain are serving the ads.txt file separately.

For example:

  • https://example.com/ads.txt → Works
  • https://www.example.com/ads.txt → Loads separately or gives 404

Google treats these as two different domains, so it fails to verify your file.


3. The Fix (Working .htaccess Rule)

If you’re hosting on Hostinger, cPanel, or any Apache-based server, you can solve this with a simple redirect rule.

Open your .htaccess file (found in your site’s root directory — same folder as wp-config.php) and add this line at the top:

# Redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

4. What This Code Does

  • Forces all traffic from www to non-www version
  • Ensures there’s only one canonical domain for Google to crawl
  • Works automatically for all pages, including ads.txt
  • Returns a 301 (permanent) redirect which Google respects

After applying it:

  • https://www.example.com/ads.txt → redirects to → https://example.com/ads.txt
  • Both URLs show the same file
  • AdSense crawler finds and verifies it successfully

5. Important Tips

✅ Keep the ads.txt file exactly in your root directory (not in /wp-content or subfolders).
✅ Make sure permissions are set to 644.
✅ Don’t use multiple redirect plugins for the same rule.
✅ Clear browser and WordPress cache after changes.
✅ Wait 24–48 hours for AdSense to re-crawl your site.


6. Final Check

To confirm it’s working:

  1. Visit both https://www.example.com/ads.txt and https://example.com/ads.txt
  2. They should redirect to the same file
  3. The file should open normally in the browser

Once Google detects it, the warning in your AdSense dashboard will disappear automatically.


Conclusion

If your site is stuck in “Getting ready” or showing “ads.txt not found” for weeks, don’t waste time with plugins — the issue is usually a simple redirect misconfiguration.
Fixing your .htaccess file with the above rule solves it completely.

This method was tested and verified on Hostinger WordPress hosting, and it works flawlessly.

Published – Makemychance.com