Free Online .htaccess Generator
Tick the options you need and copy the rules into your .htaccess file. It works on Apache and LiteSpeed servers, not on Nginx.
How to Use .htaccess Master?
Select Features
Tick the security and performance options you need for your Apache server.
Get The Code
The code updates as you tick options. Use the "Copy" button to copy it.
Upload to Root
Paste the code into a file named .htaccess in your public_html folder.
What an .htaccess file does
The .htaccess (hypertext access) file is a powerful configuration file used by Apache-based web servers. It allows developers to control server behavior on a per-directory basis without modifying the main server configuration files.
Core Benefits of a Custom .htaccess File
- One address for each page: Redirecting to HTTPS and to either www or non-www keeps visitors and search engines on a single version of your site.
- Directory listing: Turning it off stops visitors from browsing the contents of a folder that has no index file.
- Gzip compression: Makes text files such as HTML, CSS and JavaScript smaller when they are sent, which usually helps pages load faster.
- Browser caching: Tells browsers to keep images and stylesheets for a while, so repeat visits load faster.
Frequently Asked Questions
Where do I upload the .htaccess file?
Upload it to your domain's root directory (usually public_html or htdocs) with an FTP client or File Manager. If you do not see the file afterwards, turn on Show Hidden Files, because names that start with a dot are hidden.
Can .htaccess break my website?
Yes. Apache is strict about syntax, and a wrong rule can cause a 500 Internal Server Error. These rules have not been tested on your server, so keep a backup of your original file and test the site after you upload.