Host app-ads.txt at your root domain
Place app-ads.txt in the public/ directory at the root of your project. Vercel serves all files in public/ at the root domain. This works for Next.js, Vite, Create React App, and most other frameworks Vercel supports.
Commit and push. Vercel will redeploy and serve the file at https://yourdomain.com/app-ads.txt.
Verify at https://yourdomain.com/app-ads.txt.
Note: If you are using Next.js App Router and prefer to serve the file via a route handler rather than the public/ directory, use a route handler at app/app-ads.txt/route.ts that returns a plain text Response. However, the public/ directory approach is simpler and avoids any edge function invocation.
Allow the Google-adstxt crawler in robots.txt
If you use Next.js App Router, the recommended approach is a robots.ts file at app/robots.ts:
import type { MetadataRoute } from 'next';
export default function robots(): MetadataRoute.Robots {
return {
rules: [
{ userAgent: 'Google-adstxt', allow: '/app-ads.txt' },
{ userAgent: '*', disallow: '' },
],
};
}For non-Next.js projects, place robots.txt in the public/ directory directly.
Verify at https://yourdomain.com/robots.txt.
Set up a 301 redirect (if needed)
Add a redirect in vercel.json:
{
"redirects": [
{
"source": "/app-ads.txt",
"destination": "https://yourdomain.com/app-ads.txt",
"permanent": true
}
]
}Deploy and verify the redirect resolves to the raw file.
Done setting up?
Run a free scan to confirm your app-ads.txt is reachable and correctly configured.
Using a different platform? Browse all platform guides