.htaccess Generator
Generate .htaccess files for Apache servers. Configure HTTPS redirect, security headers, Gzip compression, browser caching, hotlinking protection, and custom redirects.
🔒 HTTPS and domain
🛡️ Security
⚡ Performance
🔗 Hotlinking and CORS
↪️ Custom redirects
📄 .htaccess
💡 Upload this as .htaccess to your Apache server root directory.
⚠️ Important
- • Back up your existing .htaccess before replacing it.
- • Test the site thoroughly after applying the changes.
- • .htaccess only works on Apache servers.
- • On Nginx, use the equivalent directives in nginx.conf instead.
.htaccess Generator
Our free .htaccess Generator helps you create properly configured .htaccess files for Apache web servers. Enable HTTPS forced redirect, WWW preference, security headers, Gzip compression, browser caching, hotlinking protection, and custom redirects. Includes presets for WordPress, security, and performance optimization.
Popular Tools
About .htaccess Generator
Apache configuration assembled from checkboxes: force HTTPS, pick a www or non-www canonical, disable directory listing, block .env and wp-config style files, add HSTS and other security headers, switch on mod_deflate compression and per-type mod_expires cache lifetimes, plus hotlink protection, 301 redirects, custom ErrorDocument pages, IP deny rules and bad-bot filtering. WordPress, security, performance and minimal presets set the toggles in one pass, which covers most shared-hosting setups. The file is written in the page and can be copied or downloaded as .htaccess.
Use Cases
How to use
Click a preset to start from: WordPress, Security, Performance or Minimal.
Under HTTPS & Domain tick Force HTTPS and set the WWW Preference to Force www, Force non-www or No preference.
In Security switch on directory listing protection, blocking of sensitive files such as .env and .htpasswd, security headers, xmlrpc.php blocking and SEO bot blocking.
In Performance enable Gzip compression and browser caching, then set cache lifetimes in seconds for HTML, CSS, JavaScript and images.
Add image hotlink protection with your domain, CORS headers, and any 301 or 302 rules using + Add Redirect.
Click Download to save the .htaccess file or Copy the rules, back up your existing file, then upload it to your Apache site root.
Pro Tips
- Paste your content directly — the Htaccess Generator detects common input patterns and applies sensible defaults automatically.
- Use keyboard shortcuts (Ctrl/Cmd+A to select all, Ctrl/Cmd+C to copy) to speed up your workflow inside the Htaccess Generator.
- For very large inputs, break them into chunks — most browser tabs can handle megabytes of text, but parsing huge payloads may freeze the UI briefly.
- The Htaccess Generator does not log or store your input. If you need history, copy important outputs to a local file or note app.
- Combine the Htaccess Generator with other tools on this site (formatters, converters, encoders) to build complete data pipelines without leaving your browser.
Frequently Asked Questions
Yes, fully free with no signup, no API key, no watermarks, and no usage limits.
No. The Htaccess Generator runs entirely client-side in your browser. Your input never touches our servers.
There is no hard limit, but expect slowdowns on inputs larger than a few megabytes, depending on your device's memory.
Yes. Outputs generated with the Htaccess Generator are yours to use freely in any personal or commercial project.
Most of the logic runs in client-side JavaScript, so after the initial load you can often keep working without a network connection.
None. Because the Htaccess Generator runs in your browser, you can process as many inputs as your hardware allows without API keys or throttling.