All free tools

Free tool

WordPress

WordPress .htaccess Generator

Generate WordPress .htaccess rules for permalinks, HTTPS, redirects, and hardening. Copy the file and keep a backup of the live one.

Runs in your browser — your data stays on your device

Free tool

Canonical host

.htaccess
# Generated by Binary Tech Institute WordPress .htaccess Generator
# Back up your current .htaccess before you replace it.

# Force HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Protect wp-config.php
<Files wp-config.php>
Require all denied
</Files>

# Protect .htaccess
<Files .htaccess>
Require all denied
</Files>

# Disable directory listing
Options -Indexes

# Browser caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType font/woff2 "access plus 1 year"
</IfModule>

# GZIP compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
AddOutputFilterByType DEFLATE application/javascript application/json application/xml
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
  • This file belongs in the WordPress site root (the same folder as wp-config.php), not inside wp-admin.
  • Always download a copy of the live .htaccess before you overwrite it.
  • Keep the WordPress permalink block if pretty permalinks are on. Saving Permalinks in wp-admin rewrites that block.

The WordPress .htaccess file is how Apache turns pretty permalinks, HTTPS, and a handful of security rules into server behaviour without another plugin. We still see site owners paste a random 'security pack' and lock themselves out of wp-admin. This free WordPress .htaccess generator builds a readable file from the options you tick: the core permalink block, HTTPS, www versus apex, wp-config protection, optional xmlrpc blocks, caching, and a single 301 redirect. Use it for technical SEO and WordPress administration, then test on staging first.

How to use the WordPress .htaccess Generator

  1. 1

    Tick permalinks, HTTPS, security, and performance options. Add a source path and destination if you need one redirect.

  2. 2

    Copy the generated file and keep a backup of the live .htaccess.

  3. 3

    Upload it to the WordPress root (next to wp-config.php) and load the site, wp-admin, and a pretty permalink before you leave.

Why we generate .htaccess instead of stacking plugins

Permalink rules belong in .htaccess. So do simple 301s and HTTPS redirects. A plugin that writes the same rules adds update risk and often duplicates RewriteEngine blocks. Website owners who understand the file can fix a white screen after a bad paste. That is a technical SEO skill, not a theme setting.

WordPress .htaccess generator with examples

Leave pretty permalinks and HTTPS on, set a redirect from old-page to https://example.com/new-page, and copy the file. The generator writes a 301 RewriteRule plus the standard WordPress block. That is the same pattern we use when a small business rebrands a URL without installing a redirect plugin.

Guides and next steps

Privacy note

Generation runs in your browser. We do not store the rules you generate.

Frequently asked questions

Ready to go beyond free tools?

Live mentor-led courses turn calculator practice into real networking and IT skill.