Tools › Build › robots.txt & .htaccess Generator
🤖

robots.txt & .htaccess Generator

Create and test robots.txt rules, and build a safe .htaccess for HTTPS, redirects, caching and security.

🤖 Block AI crawlers
🧪 Test URLs against rules
🔀 HTTPS, www & redirects
🔒 Runs in your browser
🤖

robots.txt and .htaccess generator

Control what search engines crawl, and set up redirects, HTTPS, caching and security for Apache and LiteSpeed sites.

Start from:Add:

Sitemaps

Give the full address of each sitemap so crawlers can find it.

Your robots.txt



Upload the file to the root of your website so it opens at yourdomain.com/robots.txt. Each subdomain needs its own file.

Test your rules

See whether a crawler may fetch a page. It uses Google’s matching rules: the most specific (longest) rule wins, and Allow wins a tie.

Already have a robots.txt? Paste it to edit it

How to use

  1. Choose robots.txt or .htaccess at the top.
  2. Start from a preset, then adjust the options for your site.
  3. Test pages against your robots.txt rules, or read the warnings under the .htaccess output.
  4. Copy or download the file and upload it to your website’s main folder.

What is a robots.txt file?

A robots.txt file is a plain text file at the root of your website that tells crawlers which parts of the site they may visit. Search engines read it before crawling. It is made of groups: a User-agent line that says which crawler the group is for, followed by Allow and Disallow rules. A Sitemap line points crawlers to your sitemap.

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://example.com/sitemap.xml

What robots.txt can and can’t do

  • It controls crawling, not indexing. A blocked page can still appear in search results if other sites link to it. To keep a page out of search, leave it crawlable and add a noindex meta tag, or protect it with a password.
  • It is not security. The file is public, and bad bots ignore it. Never list secret URLs in it.
  • Don’t block CSS and JavaScript that your pages need. Google renders pages and needs those files.
  • Wildcards: * matches any characters and $ marks the end of a URL, for example Disallow: /*.pdf$.
  • When rules conflict, the longest (most specific) rule wins, and Allow wins a tie.

AI crawlers you can block

If you don’t want your content used to train AI models, you can block their crawlers. These are the user-agent names published by each company.

User-agentCompanyWhat it does
GPTBotOpenAICollects content that may be used to train models
ChatGPT-UserOpenAIFetches pages when a ChatGPT user asks for them
OAI-SearchBotOpenAIBuilds the search index used by ChatGPT search
ClaudeBotAnthropicCollects content that may contribute to training
Claude-UserAnthropicFetches pages when a Claude user asks for them
Claude-SearchBotAnthropicImproves the quality of search results
Google-ExtendedGoogleControls whether Gemini and Vertex AI may use your content; it doesn’t affect Google Search
CCBotCommon CrawlOpen web archive used by many AI projects
PerplexityBotPerplexityBuilds the Perplexity search index
BytespiderByteDanceCrawler for ByteDance products
Applebot-ExtendedAppleControls whether Apple may use your content to train its AI models
meta-externalagentMetaCrawler for Meta’s AI products

Blocking the “search” and “user” bots can reduce how often your site is mentioned in AI answers. Compliance is voluntary: well-behaved crawlers follow robots.txt, but it isn’t a firewall.

Common .htaccess tasks

  • Force HTTPS and one hostname. Redirect HTTP to HTTPS and choose www or non-www, in a single step so visitors aren’t bounced twice.
  • 301 redirects from old URLs to new ones keep your search rankings when you move pages.
  • Clean URLs without .php or .html make addresses shorter and easier to share.
  • Compression and caching make pages load faster and improve Core Web Vitals.
  • Security headers and blocking protect against common attacks and keep hidden files private.

Frequently asked questions

Where do I put the robots.txt file?

In the root folder of your site, so it opens at yourdomain.com/robots.txt. A file in a subfolder is ignored. Each subdomain needs its own robots.txt.

Does robots.txt remove a page from Google?

No. It only stops crawling. To remove a page from search results, use a noindex tag (and let the page be crawled so Google can see the tag) or Google’s removal tool.

What does User-agent: * mean?

The asterisk means “all crawlers”. Rules in that group apply to every crawler that doesn’t have its own more specific group.

What does Disallow: / do?

It blocks the whole site for the crawlers in that group. Use it only for staging or private sites. A site that is blocked this way will drop out of search results.

How do I block AI crawlers like GPTBot and ClaudeBot?

Click “+ Block AI training bots” in the generator. It adds one group listing the crawlers with Disallow: /. Use “+ Block all AI bots” to also block the crawlers that fetch pages for AI search and assistants.

Where is the .htaccess file?

In your website’s main folder (often called public_html or www). It starts with a dot, so some file managers hide it. Turn on “show hidden files”. If it doesn’t exist, create a new text file named .htaccess.

Why do I get a 500 error after changing .htaccess?

A rule has a mistake, or uses a feature your server doesn’t support. Restore your backup, then add the rules back a few at a time to find the one that breaks. Your host’s error log shows the exact line.

Will .htaccess work on Nginx?

No. Nginx ignores .htaccess files and needs the equivalent rules in its own configuration. Apache and LiteSpeed (used by many shared hosts) read .htaccess.

Are my settings sent anywhere?

No. Both files are built in your browser. Nothing is uploaded, and the tool is free with no sign-up.