Menu

1 / 2

How to Fix the ads.txt 500 Error on Next.js App Router with Vercel

DEV Community·bi kai·6 months ago
#gk6gkh6c
#nextjs#vercel#seo#adsense#router
Reading 0:00
15s threshold

If you've ever tried to apply for Google AdSense with a Next.js App Router site deployed on Vercel, you may have run into a frustrating issue: visiting your-domain.com/ads.txt returns a 500 Internal Server Error , even though the file exists in your public/ directory and works fine in local development.

This post explains why it happens and shares the cleanest fix I found while preparing my own site for AdSense submission.

The Problem

The conventional way to serve ads.txt is to drop it into the public/ directory.

In a Pages Router project, this works without issue.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.