.htaccess Generator
Build common Apache rewrite and redirect rules visually.
Generate Apache .htaccess Rules
The .htaccess file lets you configure the Apache web server per-directory â redirects, HTTPS enforcement, canonical domains, and access rules â without touching the main server config. This generator assembles the most common, battle-tested rules for you.
What you can build
- Force HTTPS for every request
- Pick a www or non-www canonical host
- 301 redirects for moved pages
- Custom error pages and hotlink protection
How to deploy it
Save the output as a file literally named .htaccess in the directory you want it to govern (usually your site root) on an Apache server with mod_rewrite enabled.
Test before you ship
A syntax error in .htaccess can take a whole site down with a 500 error, so always back up the existing file and test on staging first. Note that .htaccess is Apache-specific â Nginx and other servers use different configuration formats.
Private & Processed Locally
This generator runs entirely in your browser. Nothing you type is uploaded to a server, so it is safe for staging URLs, internal paths, and unreleased content, and it keeps working even when you are offline.
It is free to use with no sign-up and no limits â copy or download the output and drop it straight into your site.
Frequently Asked Questions
Common questions about the .htaccess Generator.