Google Adsense Ads.txt cannot be detected in my website, eventhough placed in file explorer

I added ads.txt to file explorer inside Google Ai Studio, and when i open the URL domain .com/ads.txt it says Cannot GET /ads.txt

Hi @JSheng
Welcome to the Google AI Forum!!!

Thank you for reaching out!
If you can share an example with steps to reproduce the issue, it helps us to reproduce and showcase to the appropriate teams.

Thanks!

In AI Studio, any files that need to get accessed from the browser will need to be in the /public folder. This means you need to create a new folder ‘public’ in lowercase and move the ads.txt in this folder. Then distribute your app again and POOF! It should work.

If not, then I’m bad at mind-reading. :smiley:

1 Like

Yes, in this case it is working when i check with domain. com/public /ads.txt . But to monetize with google adsense on my website, the crawler can only check domain com/ads.txt so if adding a public folder will affect the detection of the ads.txt file. any solution? thanks btw

Okay, let’s go over the steps:

  1. You develop the React app in AI Studio.
  2. You use NPM to install it on your server using Vite or something else.
  3. The Vite build will use the /public folder as the web root. All other folders in your project cannot be reached.

That build tool basically “compiles” the React application to JavaScript and HTML in the root folder. Thus it should still be example. com/ads.txt and not example .com/public/ads.txt or else you might not be deploying the app as it should.

So far I’ve only deployed my apps on my Linux server using NPM and VITE, and this is why I have a /public folder. If you deploy your app in some other way, then you might have to check where any public files need to be stored. But in general, the folders with your source code are generally not accessible from the Internet, which is why a build process like Vite is used to generate the JavaScript from your app for publication.