.htaccess Generator
Pick common Apache rules (force HTTPS, www redirect, directory protection, gzip, custom 404) and get a copy-ready .htaccess file.
About
On Apache/LiteSpeed servers, redirect and security rules live in the .htaccess file. Instead of memorising the syntax, check the options you want and the correct RewriteRules and directives are built for you.
All generation happens in your browser; your details are never sent out. Upload the generated file to your site's root directory.
How to use
- Enter your domain and tick the rules you want.
- See the generated .htaccess content below.
- Copy it and paste into the .htaccess file on your server.
Frequently Asked Questions
- Where do I put this file?
- Usually in your site's root directory (public_html), named .htaccess. An Apache or LiteSpeed server is required.
- Are the redirects permanent (301)?
- Yes. HTTPS and www redirects are generated as 301 (permanent), which is best for SEO.
Other tools
Embed this tool
Copy the code below and paste it into your site's HTML to embed this tool for free. The snippet includes an attribution link back to the source.
<iframe src="https://tooldict.com/embed/en/htaccess-generator" title=".htaccess Generator" width="100%" height="600" style="border:1px solid #e2e8f0;border-radius:16px;max-width:680px" loading="lazy"></iframe>
<p style="font:13px/1.5 sans-serif">Powered by <a href="https://tooldict.com/en/htaccess-generator" target="_blank" rel="noopener">.htaccess Generator</a> — Tooldict</p>