About .htaccess
This tool builds an Apache .htaccess file from a checklist of common rules — forcing HTTPS, redirecting www, custom error pages, gzip compression, browser caching, hotlink protection and more — and gives you the finished file to copy. It runs in your browser; nothing is uploaded.
How htaccess works
How to use it
- Tick the rules you want and fill in your domain or file names where asked.
- Copy the generated text into a plain file named .htaccess in your site root folder.
- Test on a staging copy before going live.
What is .htaccess?
A .htaccess file is a per-directory configuration file for the Apache web server (and LiteSpeed). It can redirect URLs, force HTTPS, set caching headers, protect files and customise error pages — without editing the main server config. Rewrite rules need mod_rewrite enabled, which is standard on most hosts.
Common uses
- Force HTTPS on a site
- Redirect www to non-www
- Add custom 404 and error pages
- Enable gzip compression
- Set browser caching
- Block image hotlinking
- Disable directory listing
- Set a default index page
Frequently asked questions
Where do I put the .htaccess file?
In the root folder of your website (or any subfolder you want it to affect), as a plain file named exactly .htaccess.
Does this work on Nginx?
No — .htaccess is for Apache and LiteSpeed. Nginx uses its own server config.
Will forcing HTTPS need an SSL certificate?
Yes — install an SSL certificate first, then the redirect sends visitors to the secure version.
Why is my rewrite rule ignored?
The host needs mod_rewrite enabled; most do. Check the mod_rewrite IfModule block is present.
Is my input uploaded?
No — the file is built entirely in your browser.
Is it free?
Yes, completely free.