.htaccess Generator for WordPress
Select the rules you need and the tool assembles a ready-to-use .htaccess file for an Apache or LiteSpeed server. It is a simple yet effective way to harden WordPress security: protecting login, blocking sensitive files and attack vectors before PHP even runs. Everything is computed in your browser; no data is sent to a server. After generating, copy the contents or download the file and upload it to your site's root directory. Always make a backup of the existing file before overwriting.
The standard rewrite block required by WordPress (permalinks). If you are editing an existing file, this block is usually already there.
Redirects all traffic from http to https (301).
Blocks direct access to the configuration file containing your database credentials.
Disables a common brute-force and DDoS amplification vector. Note: it also blocks the WordPress mobile app and some plugins (e.g. Jetpack).
Restricts access to login: by .htpasswd password, by IP address, or "IP or password". An effective barrier against brute-force attacks on the panel.
Blocks browser access to .htaccess and .htpasswd.
Prevents showing directory contents when there is no index.php (e.g. /wp-content/uploads).
Compresses text, CSS, JS and HTML for faster page loads.
Sets a long cache time for images, CSS and JS. Helps Core Web Vitals.
# BEGIN WordPress and # END WordPress markers — WordPress may overwrite it. After uploading, verify that the site and login work; restore the backup if anything breaks.

