How to use the robots.txt generator
- Enter your sitemap URL. Rank Math uses /sitemap_index.xml, and Yoast uses /sitemap_index.xml too.
- Choose a preset. WordPress is the safe choice for most sites.
- Add any extra folders you want to block and tick any AI crawlers you want to block.
- Download the file and upload it to the root of your website, or paste it into the robots.txt editor in Rank Math (General Settings › Edit robots.txt).
What is robots.txt?
Robots.txt is a plain text file at yourdomain.com/robots.txt. It gives instructions to crawlers like Googlebot about which parts of your site they should not crawl. It is the first file most bots check when they visit.
Common robots.txt mistakes
- Blocking the whole site by accident with “Disallow: /”, often left over from a staging site.
- Blocking CSS and JavaScript, which stops Google from seeing your page properly.
- Using robots.txt to hide pages from Google. Blocked pages can still appear in search if other sites link to them. Use a noindex tag instead.
- Forgetting the sitemap line, which helps search engines find all your pages.
Should I block AI crawlers?
That is a business choice. Blocking bots like GPTBot stops your content being used to train AI models, but it may also reduce how often AI assistants mention or link to your business. Blocking AI bots does not affect your Google search rankings.
After uploading, check your site with our Website Audit Tool.
Frequently Asked Questions
Where do I put robots.txt?
In the root folder of your domain, so it opens at https://yourdomain.com/robots.txt. It will not work in a subfolder.
Does robots.txt stop pages appearing in Google?
Not reliably. It stops crawling, not indexing. To keep a page out of Google, use a noindex meta tag and allow crawling.
What is a good robots.txt for WordPress?
Block /wp-admin/ but allow /wp-admin/admin-ajax.php, block internal search pages, and add your sitemap. That is exactly what the WordPress preset does.
Does Google follow Crawl-delay?
No. Google ignores Crawl-delay, though Bing and some other bots respect it.