Create a robots.txt file to control how search engines crawl your website. Configure user-agents, allow/disallow rules, and sitemap URL.
Note: Most major crawlers (Google, Bing) ignore Crawl-delay. Used mainly for smaller crawlers.
User-agent: * Disallow: /admin/ Sitemap: https://example.com/sitemap.xml
The robots.txt file tells search engine crawlers which pages or directories they can or cannot request from your site. It is placed in the root of your website (e.g., https://yoursite.com/robots.txt) and follows a simple directive-based format.
User-agent identifies the crawler (e.g., * for all, Googlebot for Google). Allow and Disallow specify paths that crawlers may or may not access. Disallow rules help you block admin panels, API endpoints, and other areas you do not want indexed.
Including your Sitemap URL helps search engines discover your pages efficiently. Crawl-delay (in seconds) limits request frequency, but most major search engines ignore it; it is mainly useful for smaller bots.
* for all bots, Googlebot for Google, Bingbot for Bing)./admin, /api, /private, and staging environments.https://yoursite.com/sitemap.xml) to help search engines discover all your pages efficiently.https://yoursite.com/robots.txt).Not exactly. Robots.txt tells crawlers not to crawl specific paths, but if other pages link to a disallowed URL, search engines may still index it (showing the URL without a snippet). To fully prevent indexing, use a noindex meta tag or X-Robots-Tag header in addition to robots.txt rules. Learn more with our Meta Tag Generator.
The file must be at the root of your domain: https://yoursite.com/robots.txt. Subdomains need their own robots.txt files. In Next.js projects, you can generate it programmatically using a robots.ts file in the app directory.
Most major search engines (Google, Bing) ignore the crawl-delay directive and manage their own crawl rates. It can be useful for smaller bots that respect it. For enterprise SEO strategy and technical optimization, explore our SEO services or check your site's health with our other SEO tools.