.htaccess generator

Check the desired options to generate a .htaccess file for an Apache server. 100% local generation in your browser — nothing is sent to a server.

Example:
Result (.htaccess)

How it works

The .htaccess file allows you to configure the behavior of an Apache server at the folder level, without access to the server's main configuration file — typical of shared hosting. Its syntax (RewriteRule, RewriteCond directives, etc.) is not very intuitive and an error can cause a 500 error across the whole site. This tool generates the most common blocks (HTTPS redirect, www handling, custom error page, password protection) ready to copy.

Where should I place this file?

The file must be named exactly .htaccess (with the leading dot, no extension) and placed at the root of the folder you want to configure, generally the site's root. It only works on an Apache server with the mod_rewrite module enabled — it's ignored by Nginx or other servers.

How do I create the .htpasswd file needed for password protection?

The .htaccess file only contains a reference to the password file, not the passwords themselves. You need to separately generate a .htpasswd file (one line per user, hashed password) using the htpasswd command-line utility bundled with Apache, or a dedicated generator, then upload it to the path specified in the AuthUserFile directive.

100% local processing in your browser — nothing is sent to a server.