.htaccess Generator

Build HTTPS, www and security rules for Apache.

Runs locallyWorks offlineShare link carries settings, never your data
Send output toBase64 Encode / DecodeCode FormatterRegex Tester & BuilderBuild a workflow from thisOutput stays on this page until you send it.

Frequently asked questions

Which servers use .htaccess?

Apache, and only when the server is configured to allow it. Nginx ignores these files entirely — its rules live in the main server config — so on Nginx or most modern hosts these directives will do nothing.

Should a redirect be 301 or 302?

301 for anything permanent, such as a moved page or forcing a canonical host, because that is what consolidates ranking signals onto the new URL. 302 is for genuinely temporary moves; using it for a permanent one leaves the old URL indexed indefinitely.

Why did my rewrite rule break the whole site?

Almost always a syntax error or a redirect loop — .htaccess is applied per request, so one bad line returns a 500 for every page immediately. Always keep a copy of the working file before editing, and test one rule at a time.

Pro tips

  • Never promote a staging robots.txt to production. `Disallow: /` removes a whole site from search, and recovery takes weeks of recrawling.
  • Use a noindex tag, not a robots.txt block, when the goal is keeping a page out of results rather than out of the crawler's fetch queue.
  • List the sitemap URL in robots.txt as an absolute URL; it is the one directive that does not take a path.
  • Test .htaccess redirect rules on a copy first. A malformed rule takes the whole site down with a 500, not just the affected path.
  • Keep the sitemap to canonical URLs only — listing redirects and noindex pages spends crawl budget for nothing.

About Webmaster File Generator

One thing worth knowing before you use it: robots.txt controls crawling, not indexing. A blocked URL can still surface in results when something else links to it, and suppressing that needs a noindex tag instead.

Generate an Apache .htaccess with HTTPS and www redirects, directory-listing blocks and custom error pages. The rules are built in your browser, ready to paste in.

Build a robots.txt with crawl rules, a valid XML sitemap from your list of page URLs, and a .htaccess with HTTPS and www redirects plus common security options. These three files are the backbone of a well-configured, search-friendly website.

Copy the output and drop each file into your site's root. A correct robots.txt and sitemap help search engines crawl efficiently, while .htaccess rules enforce HTTPS and clean redirects.

The most consequential thing to understand about robots.txt is what it does not do. It requests that compliant crawlers avoid fetching a URL; it does not remove that URL from an index. A blocked page that other sites link to can still appear in results, listed without a description, precisely because the crawler was told not to fetch it and therefore could not read the noindex tag that would have removed it. Blocking and deindexing are different operations, and using the first when you meant the second is why pages linger in search results long after someone believed they had removed them.

Two details cause most robots.txt mistakes. Rules attach to the most recently declared User-agent line, so a directive placed under the wrong block silently governs a different crawler than intended. And paths are prefixes rather than patterns, so `Disallow: /admin` also blocks `/administrator` and anything else beginning with those characters. The file also governs only the host it is served from, so a subdomain needs its own.

Common use cases

  • Forcing HTTPS or a single canonical www/non-www host
  • Setting up 301 redirects after restructuring URLs
  • Adding cache-control or security headers on shared hosting
How it comparesSearch Console and the equivalents at Bing test a robots.txt against real URLs, which is the right way to verify one and requires the site to be verified first. This is the authoring step that comes before that: getting a syntactically correct file to upload in the first place.