Create and test robots.txt rules, and build a safe .htaccess for HTTPS, redirects, caching and security.
Control what search engines crawl, and set up redirects, HTTPS, caching and security for Apache and LiteSpeed sites.
Give the full address of each sitemap so crawlers can find it.
Upload the file to the root of your website so it opens at yourdomain.com/robots.txt. Each subdomain needs its own file.
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.
| Page | Result | Rule that decided it |
|---|
Send every visitor to one version of your address, so search engines don’t see duplicates.
One per line: the old path, the new address, then an optional code (301, 302, 303, 307, 308 or 410). 301 is the default and is right for permanent moves. Use 410 to mark a page as gone.
These assume your site is in the main web folder.
The path to a page on your site, for example /404.html.
Smaller downloads and fewer repeat requests make pages load faster.
If you edit a CSS or JS file without renaming it, visitors may keep seeing the old one until the time is up. Add a version to the file name (style.css?v=2) when you change it.
Show a “back soon” page with a proper 503 status, which tells search engines the downtime is temporary.
The maintenance page can’t use images or CSS from your site, because those requests are also paused. Put its styles inline.
Save it as .htaccess (with the leading dot, no .txt) in your site’s main folder, for example public_html. If your computer renames the download, rename it back.
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
noindex meta tag, or protect it with a password.* matches any characters and $ marks the end of a URL, for example Disallow: /*.pdf$.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-agent | Company | What it does |
|---|---|---|
| GPTBot | OpenAI | Collects content that may be used to train models |
| ChatGPT-User | OpenAI | Fetches pages when a ChatGPT user asks for them |
| OAI-SearchBot | OpenAI | Builds the search index used by ChatGPT search |
| ClaudeBot | Anthropic | Collects content that may contribute to training |
| Claude-User | Anthropic | Fetches pages when a Claude user asks for them |
| Claude-SearchBot | Anthropic | Improves the quality of search results |
| Google-Extended | Controls whether Gemini and Vertex AI may use your content; it doesn’t affect Google Search | |
| CCBot | Common Crawl | Open web archive used by many AI projects |
| PerplexityBot | Perplexity | Builds the Perplexity search index |
| Bytespider | ByteDance | Crawler for ByteDance products |
| Applebot-Extended | Apple | Controls whether Apple may use your content to train its AI models |
| meta-externalagent | Meta | Crawler 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.
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.
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.
The asterisk means “all crawlers”. Rules in that group apply to every crawler that doesn’t have its own more specific group.
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.
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.
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.
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.
No. Nginx ignores .htaccess files and needs the equivalent rules in its own configuration. Apache and LiteSpeed (used by many shared hosts) read .htaccess.
No. Both files are built in your browser. Nothing is uploaded, and the tool is free with no sign-up.