← All tools

robots.txt & .htaccess Generator

Build robots.txt with presets and an AI-crawler block, test URLs, and create .htaccess rules.

Free tool No account
Test a URL against this file

✗ Blocked · Disallow: /admin/ · User-agent: *

ReadyProcessed locally · No upload
Enjoying robots.txt & .htaccess Generator?Your review and ideas shape what we build next.

Review robots.txt & .htaccess Generator

Please don't include file contents or passwords.

About the robots.txt & .htaccess Generator

Create a correct robots.txt file in a few clicks, test whether any address is allowed or blocked for Googlebot, Bingbot or an AI crawler, or paste your live robots.txt to check it. The .htaccess tab builds Apache rules for HTTPS, www redirects, moved pages, compression, caching, security headers and a custom 404 page.

How to use it

  1. Choose robots.txt, pick a preset (Allow everything, Block everything, WordPress or Online shop) and adjust the paths.
  2. Add your sitemap address and tick Block AI crawlers if you don't want your pages used for AI training.
  3. Type an address under Test a URL to see whether it's allowed, and which rule decided it.
  4. Download the file and upload it to the root of your site, so it opens at yourdomain.com/robots.txt.

Tip: robots.txt controls crawling, not indexing. A blocked page can still appear in Google if other sites link to it. To keep a page out of search results, allow crawling and add a noindex meta tag or X-Robots-Tag header instead.

robots.txt directives

User-agent
Which crawler the rules below are for. * means every crawler; Googlebot, Bingbot or GPTBot name one.
Disallow
A path the crawler shouldn't visit. Disallow: /admin/ blocks everything in that folder; an empty Disallow: blocks nothing.
Allow
An exception inside a blocked folder: Allow: /wp-admin/admin-ajax.php.
Sitemap
The full address of your XML sitemap. You can list several, one per line.
Crawl-delay
Seconds to wait between requests. Bing and Yandex follow it; Google ignores it.
* and $
* matches any characters, so /*?sort= blocks every sorted URL; $ marks the end, so /*.pdf$ blocks PDF files only.

How Google decides between rules

A crawler follows only the group for its most specific name: Googlebot uses a Googlebot group if there is one and ignores the * group completely. Within a group, the longest matching path wins, whatever the order of the lines. If an Allow and a Disallow rule are the same length, Allow wins.

So with Disallow: /admin/ and Allow: /admin/help, the address /admin/help/faq is allowed (the Allow rule is longer) and /admin/users is blocked. The tester applies exactly these rules and shows the rule that decided.

Blocking AI crawlers

Tick Block AI crawlers to add a group that stops twelve well-known AI and training crawlers, including GPTBot and ChatGPT-User (OpenAI), Google-Extended (Gemini training), ClaudeBot (Anthropic), PerplexityBot, CCBot (Common Crawl), Applebot-Extended, Meta-ExternalAgent, Bytespider and Amazonbot. Blocking Google-Extended doesn't affect Google Search. Reputable crawlers respect robots.txt, but it is a request, not a lock: protect private content with a login.

Common robots.txt mistakes

Disallow: / on a live site
Blocks every page from search engines. It often survives from a staging site; the tool warns you.
Blocking CSS and JavaScript
Google needs them to render your pages. Don't disallow /assets/ or /static/.
Using robots.txt to hide pages
The file is public, so listing /secret-admin/ tells everyone where it is.
Full URLs in Disallow
Rules take paths only. The tool turns https://example.com/private into /private for you.
Wrong location
It must be at the root of each host: blog.example.com needs its own file.

.htaccess rules for Apache

The .htaccess tab writes rules for Apache servers (common on shared hosting): force HTTPS, choose www or non-www as your one address, redirect moved pages with 301 so they keep their ranking, add compression and browser caching for speed, add security headers, hide folder listings and set a custom 404 page. All redirect rules sit in one block with RewriteEngine On. Nginx, Vercel and Netlify don't read .htaccess; they have their own settings.

Example robots.txt files

Allow everything
User-agent: * and an empty Disallow: line, plus your Sitemap: line. Right for most small sites.
WordPress
Disallow: /wp-admin/ with Allow: /wp-admin/admin-ajax.php, so themes and plugins keep working, and block internal search with Disallow: /?s=.
Online shop
Block /cart/, /checkout/, /account/ and sorting or filter parameters, keep product and category pages open.
Staging site
Disallow: / for every crawler, but protect it with a password too, and remember to change the file before launch.

Testing a live robots.txt

Choose Check a robots.txt, paste the file from yourdomain.com/robots.txt and test the pages that matter. The tester picks the group the crawler would use, applies the longest-match rule and names the line that decided, so you can see at once why a page is blocked. Try the same address for Googlebot, Bingbot and * because groups can differ.

Tips and tricks

Test before you upload

Check your most important pages and a page you want blocked with the tester, for Googlebot and for *.

Block filters, not products

On shops, disallow sorting and filter parameters (/*?sort=) so crawlers spend their time on real product pages.

Check it in Search Console

Google Search Console's robots.txt report shows the version Google fetched and any errors.

Keep it small

Google reads only the first 500 KB of a robots.txt file.

Questions

Where do I put robots.txt?

In the root folder of your website, so it opens at https://yourdomain.com/robots.txt. In WordPress, upload it to the same folder as wp-config.php, or use your SEO plugin's editor.

Does robots.txt remove a page from Google?

No. It stops crawling, but a blocked page can still be listed. Use noindex and let Google crawl the page to see it.

Is robots.txt case-sensitive?

The paths are: /Admin and /admin are different. The directive names (Disallow, Allow) are not.

How do I allow everything?

Use User-agent: * with an empty Disallow: line, which is what the Allow everything preset writes.

Should I block AI bots?

It's your choice. Blocking stops well-behaved AI crawlers from using your pages for training or AI answers; it doesn't change normal search rankings.

How long until Google sees my new robots.txt?

Google usually caches robots.txt for up to 24 hours. You can ask for a faster refresh from the robots.txt report in Search Console.

Do I need a robots.txt at all?

No, a site without one is crawled normally. Adding one is still useful to point crawlers to your sitemap and keep them out of search and cart pages.

Is anything I type uploaded?

No. The tool runs in your browser; what you type, paste or open never leaves your device and nothing is stored on a server.

Related tools

Updated