.htaccess Builder
ConfigurationClick a section to expand
Redirects every visitor from http:// to https:// using a 301 permanent redirect. Required for SEO and modern browsers.
Example: www.example.com → example.com. Pick this OR the next option, not both.
Example: example.com → www.example.com.
Example: /about → /about/. Helps canonicalize URLs.
Example: /about/ → /about.
Sends every request from your old domain to the matching path on your new domain with a 301 permanent redirect (preserves SEO).

Add unlimited 301/302 redirects. Use paths like /old-page → /new-page or full URLs.

Blocks other websites from embedding your images. Requests must come from one of the allowed domains (or directly).
Prompts visitors for a username and password (HTTP Basic Auth) before serving any file in this directory.
Setup: Create the password file with htpasswd -c /full/path/to/.htpasswd username on your server. Store it OUTSIDE your web root.
Sends a 503 Service Unavailable response to every visitor except whitelisted IPs. Search engines treat 503 as temporary, so SEO is preserved.

Compression

Compresses text-based responses (HTML, CSS, JS, JSON, SVG) before sending. Typically reduces payload size 60–80%.
Modern compression algorithm (15–25% smaller than GZIP). Requires mod_brotli on the server.

Browser Caching

Leave blank to skip a particular error page.

Adds Access-Control-Allow-Origin headers so other domains can fetch your fonts, APIs, or assets from JavaScript.

Tell Apache how to serve modern file formats.

Any Apache directives entered here are appended verbatim to the generated file.

1
# Click "Generate" to build your .htaccess
Explanation PanelPlain-English meaning of each rule

Generate the file to see a plain-English explanation of every directive.

Copied!