.htaccess generator
HTTPS, one address, closed .env and .git, a folder password and rules for WordPress, Laravel and Bitrix — in one file.
The .htpasswd hash is computed in your browser.
HTTPS, one address, closed .env and .git, a folder password and rules for WordPress, Laravel and Bitrix — in one file.
The .htpasswd hash is computed in your browser.
Builds an .htaccess for Apache and LiteSpeed — what most ordinary hosting runs. It includes HTTPS and a single address with or without www in one redirect, closed .env, .git, backups and dumps, no directory listing, security headers and a password on a folder, a file or the whole site. Ready rules for WordPress, Laravel, 1C-Bitrix and single-page apps are included.
The files and the password hash are made in your browser; the password is sent nowhere.
On ordinary hosting with Apache or LiteSpeed, site access is set up with an .htaccess file. By default the server serves everything in the site folder: the .env file with database passwords, the .git folder with source code, a forgotten backup.sql dump, the list of files in a folder without an index. Bots check these addresses on every site many times a day. The generator builds an .htaccess that closes them, moves the site to HTTPS and to one address with or without www in a single redirect (no http → https → no-www chain), adds security headers and, if needed, puts a password on the admin area.
Error 500 right after uploading means the hosting does not allow some directive: most often Options or a wrong path to .htpasswd. Delete the line and look at the error log in the hosting panel. “Too many redirects” means nginx or a CDN handles HTTPS: turn on that box. For an nginx-only server there is the nginx config generator, headers can be checked in HTTP security headers, and an .htpasswd hash on its own is in password hashes.
With RewriteCond %{HTTPS} off and a RewriteRule to https://%{HTTP_HOST}%{REQUEST_URI} with code 301. If nginx or a CDN sits in front of Apache, Apache sees plain HTTP, so the X-Forwarded-Proto header must be checked too — the generator adds this with the “nginx or a CDN sits in front of Apache” box.
You need two files: an .htaccess in that folder with AuthType Basic, AuthUserFile and Require valid-user, and an .htpasswd file with a login:hash line. AuthUserFile takes the full path on the server, better outside the site folder. The generator makes both, and the bcrypt hash is computed in your browser. Without HTTPS the password travels almost in clear text.
.env holds database passwords and API and mail keys, and the whole site code with its history can be downloaded from the .git folder. Bots look for these files constantly, and a found .env usually means the database is breached the same day.
Yes, if the site runs on Apache or LiteSpeed — that is most shared hosting. The rules are wrapped in IfModule, so a missing module will not break the site. If the hosting does not allow some directive, you get error 500 — then delete the line the error log points to.