Generate Robots.txt for Next.js Applications

Next.js apps expose internal routes (/_next/, /api/) that should not be indexed. A proper robots.txt prevents search engines from wasting crawl budget on framew

Open Robots.txt Generator →

Next.js apps expose internal routes (/_next/, /api/) that should not be indexed. A proper robots.txt prevents search engines from wasting crawl budget on framework files while keeping your actual pages fully accessible.

Next.js serves static assets from /_next/static/ and API endpoints from /api/. These should never appear in search results. A robots.txt file prevents this and improves crawl efficiency.

Try It Now — Free, No Sign-up

Open the tool and get started instantly. No sign-up, no installation needed.

Open Robots.txt Generator Now

100% browser-based • No upload to server • No sign-up required

How to Generate Robots.txt for Next.js Applications

  1. Select All bots (*) as user agent
  2. Add Disallow: /_next/, /api/
  3. Add Disallow for any auth routes: /auth/, /login, /signup
  4. Allow all public pages (default)
  5. Add sitemap URL (usually /sitemap.xml)
  6. Save as public/robots.txt in your Next.js project

Pro Tips

Frequently Asked Questions

Where does robots.txt go in Next.js?
Place it in the /public folder. It will be served at yourdomain.com/robots.txt automatically. No configuration needed.
Should I block /_next/ in robots.txt?
Block /_next/data/ and /_next/static/ but NOT /_next/image — image optimization URLs should be crawlable for image search.
Can I generate robots.txt dynamically in Next.js?
Yes, in App Router (Next.js 13+) create app/robots.ts that exports a function. For Pages Router, use a custom API route or static file.

Related Tools & Guides

Ready to Use Robots.txt Generator?

Free, instant, and 100% private. No sign-up needed.

Open Robots.txt Generator