EN
PortuguêsEnglishEspañol
All tools
Developer tools 100% free

.htaccess generator

Tick what you want to turn on. Each block is commented and wrapped in IfModule, so it does not take the site down if the server lacks the module.

How to use

Thank you so much for helping!

Every donation helps pay for the servers and keeps the tools free for everyone. Pick or type an amount:

Secure payment by Stripe. Opens in a new tab.

Back to SEO and publishing

.htaccess ready for your host


When downloaded, the file comes as htaccess.txt (browsers do not save names starting with a dot): rename it to .htaccess when uploading.

Available in: PortuguêsEnglish

Advertisement

.htaccess generator: what it is for

If your site is on shared hosting with Apache or LiteSpeed (such as Hostinger, Bluehost and GoDaddy), you set up redirects, caching and security through the .htaccess file.

Tick what you want to turn on and the generator builds a commented file: force HTTPS and choose the address with or without www in a single 301 redirect, compression with mod_deflate, browser caching with mod_expires, a 404 error page, Options -Indexes against directory listing, blocking .env, .git and backups, and URLs without .html. Each block is wrapped in IfModule when it depends on a module.

How to use

  1. Enter the domain and whether the main address has www.
  2. Tick the blocks you want to turn on.
  3. Download, rename to .htaccess and upload it to the site root.

When to use it

  • Forcing HTTPS after installing SSL.
  • Making the site faster with caching and compression.
  • Hiding sensitive files.

Frequently asked questions

Where do I put .htaccess?

In the site's root folder (usually public_html), through the host's file manager or by FTP. The name starts with a dot and has no extension; if your host hides hidden files, turn on the option to show them.

What if the site goes down after uploading the file?

A 500 error right after uploading .htaccess is almost always a directive the server does not accept. Rename the file to disable it and turn blocks back on one at a time. Keep a copy of the old .htaccess before replacing it, especially on WordPress, which writes its own rules into it.

Does it work for Nginx or Vercel?

No. .htaccess is only read by Apache (and LiteSpeed, which is compatible). On Nginx the rules go in the server configuration file, and hosts such as Netlify and Vercel have their own files; this site's redirect generator creates those formats.

Is it really free?

Yes, 100% free. No sign-up, no subscription and no usage limits. All Tools123 tools are free and run right in your browser.

Similar tools

The tools are provided as is, without warranty. We are not responsible for the results or for how they are used.