Code / FREE ONLINE TOOL
.htaccess Generator
Generate Apache .htaccess rules online: URL redirects, HTTPS, image hotlink protection, password protection with .htpasswd, IP access rules, caching and custom error pages.
For Apache 2.4. Add snippets to your existing configuration after making a backup. Your host must allow the relevant directives through AllowOverride. Rules are generated locally and are never applied to this website.
Create .htpasswd
The username and password stay in this browser. Each hash uses a new random salt.
Your .htaccess file
Rules run in this order. Put specific redirects before broad patterns. Repeated directives for the same setting can override earlier values.
Installation: merge these snippets into the .htaccess in the relevant directory. Domain and HTTPS redirects belong in the site root. Keep your application's existing rules. Password protection also needs the separate .htpasswd file. Some browsers remove the leading dot from downloaded filenames: rename them to exactly .htaccess and .htpasswd before uploading.
QUICK GUIDE
How to use this tool
Choose a task, configure its fields and add the rule to your file. Reorder rules before downloading. Requires Apache 2.4 and the appropriate AllowOverride permissions. Back up existing configuration and test redirects with 302 first. All generation, including password hashing, runs in your browser.
Your input is processed locally. Use Copy or Download to keep your result.
Keep your workflow moving
Need another step? Try a related tool.