What Does the .htaccess Generator Do?
This generator writes clean, commented Apache .htaccess rules from checkboxes — no need to memorize mod_rewrite syntax. It covers the configurations webmasters need most: force HTTPS, redirect between www and non-www, remove index.php/index.html from URLs, enable GZIP compression and browser caching, block image hotlinking, add security headers, disable directory listings, and define custom 301 redirects line by line.
Every rule block is wrapped in <IfModule> guards, so the file degrades gracefully if a module is missing instead of taking your site down with a 500 error.
How to Generate Your .htaccess
- Tick the rules you need; enter your domain for www/hotlink rules.
- Add any custom redirects, one per line:
/old-page /new-page. - Click Generate .htaccess and review the output — every block is commented.
- Download the file and upload it to your site's root directory. Back up your existing .htaccess first.
What the Popular Rules Do
- Force HTTPS — 301-redirects every http:// request to https://, required once you have an SSL certificate and good for SEO.
- www vs non-www — picks one canonical hostname and redirects the other, preventing duplicate-content issues.
- GZIP + caching — compresses text responses and tells browsers to reuse images/CSS/JS for months; the two cheapest speed wins available.
- Hotlink protection — stops other sites from embedding your images and burning your bandwidth.
- Security headers — nosniff, frame and referrer policies that harden the site against common attacks.