OpenReplay Logo
12k
12k

htaccess generator

Generate an Apache .htaccess file — force HTTPS, add or strip www, set redirects, enable gzip and browser caching, block IPs and add custom error pages. Built in your browser.

Options
www handling

One per line: source target — add 302 at the end for a temporary redirect.

One IP address per line.

One per line: status code path.

.htaccess
Generated locally

About this tool

An .htaccess file configures Apache on a per-directory basis: redirects, URL rewriting, compression, caching headers, access control and error pages. Writing the rules by hand is error-prone, so this tool generates correct, commented blocks from a set of toggles and inputs — turn on what you need and the file assembles itself.

Force HTTPS, normalise www, add 301/302 redirects, enable gzip (mod_deflate) and browser caching (mod_expires), block specific IP addresses and map custom error pages. The output updates live and you can copy it or download it as .htaccess. Everything runs in your browser; review the rules before deploying, since .htaccess affects how your server responds to every request.

The .htaccess is generated locally — review it before deploying to your server.

Frequently asked questions

Where do I put the generated file?

Save it as .htaccess in the directory you want it to govern — usually your site root. Apache must have AllowOverride enabled for the rules to take effect.

How do I add a temporary (302) redirect?

In the Redirects box, put the source and target on one line and add 302 at the end. Without it, the tool emits a permanent 301 redirect.

Will these rules work on Nginx?

No — .htaccess is Apache-specific. Nginx uses a different configuration syntax and does not read .htaccess files, so you would need to translate the rules into server blocks.