.htaccess generator

Build an Apache .htaccess — HTTPS force, www redirects, custom 301s, caching, and a 404 page.

Generates an Apache .htaccess using mod_rewrite. Redirect rules are host-agnostic (%{HTTP_HOST}), so no domain is needed. Redirect lines over 200 are rejected; malformed lines are skipped with a warning.

Everything runs in this browser.

How to use

  1. Toggle HTTPS force and pick a www handling.
  2. Add 301 redirect lines, caching, or a 404 path as needed.
  3. Generate, then copy or download the file.

What it supports

Uses mod_rewrite for HTTPS force and host canonicalization — the rules are host-agnostic (%{HTTP_HOST}), so no domain input is needed. Custom 301 redirects take one old-path new-path pair per line, up to 200 lines; malformed lines are skipped with a warning. mod_expires caching is wrapped in IfModule, Options -Indexes and ErrorDocument are supported. Cache days 1–3650; the 404 path must start with /. At least one directive must be enabled. IP blocking, auth, and other server-level rules are not generated.

Related tools

Related guides