.htaccess Generator

Redirects, HTTPS enforcement and cache headers, assembled into one Apache config.

Options
Start from a preset
Redirects

Output — htaccess.txt

About this tool

Build an .htaccess file from readable rules: redirects, HTTPS enforcement, gzip compression and browser cache headers. Review the output before you deploy it. Nothing leaves your browser.

Frequently asked questions

Why is my .htaccess file being ignored?

Apache only reads it when AllowOverride is enabled for that directory, and nginx never reads it at all. On nginx the equivalent rules belong in the server block.

Should I use a 301 or a 302 redirect?

Use 301 when the move is permanent - it passes ranking signals and browsers cache it. Use 302 for temporary changes such as a maintenance page or a short campaign.

Does .htaccess slow a site down?

Slightly: Apache re-reads it on every request for every directory in the path. On a server you control, move the same rules into the vhost config instead.