Skip to content
🛡️ Free tool

Hardened .htaccess Generator

Configure each security rule with a switch and get a ready-to-use file, based on OWASP Top 10 and industry best practices.

0
active rules
31
total rules
7
categories
🔐 IP Access Control
0 rules

Add IPs to generate the access rules.

🌍 Country Block/Allow
0 countries
Quick:

Add countries to generate the GeoIP rules.

⚠ Requires mod_geoip or mod_maxminddb enabled on the server. In cPanel: Software → GeoIP Database.

↪️ URL Redirects
0 redirects

Add redirects to include them in the .htaccess.

🔒 HTTPS & Redirects
Force HTTPS

Redirects all HTTP traffic to HTTPS (301 permanent)

Force www

Canonicalizes the domain with www (avoids duplicate content)

Remove www

Canonicalizes the domain without www

🛡️ Security Headers (OWASP)
HSTS (HTTP Strict Transport Security)

Tells the browser to use HTTPS for 1 year. Prevents man-in-the-middle attacks

X-Frame-Options (anti-clickjacking)

Prevents your site from being embedded in iframes on other domains (clickjacking). OWASP A05

X-Content-Type-Options (anti-sniffing)

Prevents the browser from guessing MIME types, preventing MIME sniffing attacks

Referrer-Policy (privacy)

Controls what referrer information is sent when navigating to other sites

Permissions-Policy (block browser APIs)

Disables access to camera, microphone, geolocation and other sensitive APIs

X-XSS-Protection (legacy browsers)

Enables the XSS filter on legacy browsers (old IE/Edge)

Content-Security-Policy (basic CSP) ⚠ Verify

⚠ Restrictive CSP policy. May break external scripts. Adjust to your stack

⚔️ Attack Blocking
Block XML-RPC (WordPress)

Neutralizes one of the most common brute-force attack vectors on WordPress

Block basic SQL injection

Filters typical SQL injection patterns in the query string. OWASP A03

Block XSS in query string

Blocks script injection attempts in URL parameters. OWASP A03

Block LFI/RFI (Path Traversal)

Prevents access to server files via relative paths. OWASP A01

Block malicious bots and scrapers

Rejects user-agents from known hacking tools and scrapers

Block execution in uploads

Prevents PHP/executable files in the uploads folder from running (WebShells)

Protect wp-admin by IP (WordPress) ⚠ Verify

Restricts admin panel access to only your IP

📁 File Protection
Hide .htaccess and .env

Denies direct access to sensitive configuration files

Disable directory listing

Prevents Apache from listing folder contents without index.html. OWASP A05

Hide server version

Removes headers revealing the Apache version and OS. OWASP A05

Prevent image hotlinking

Prevents other sites from using your bandwidth by loading your images directly

Block exposed backup files

Prevents access to backups (.bak, .old, .zip, .sql) commonly left accidentally public

Performance & Caching
GZIP Compression

Compresses HTML, CSS, JS before sending to the browser. Reduces size by 60-80%

Browser cache (Cache-Control)

Sets cache times for different file types. Improves speed on repeat visits

Disable ETags

Removes ETags to reduce HTTP overhead and avoid leaking the server inode

🚦 Limits & Rate Limiting
Limit request size (anti-DoS)

Limits request body to 10MB to prevent massive payload attacks

Restrict HTTP methods ⚠ Verify

Only allows GET, POST and HEAD. Blocks TRACE, TRACK, DELETE, PUT (prevents CSRF/XST)

🔑 Advanced WordPress Security
Change WordPress admin URL ⚠ Verify

Blocks the original /wp-admin and /wp-login.php and creates a custom secret URL

Block WordPress user enumeration

Prevents attackers from discovering usernames via ?author=1 (brute force vector)

Disable RSS/Atom feeds ⚠ Verify

Blocks feeds if you don't need them (reduces attack surface and scraping)

Restrict WordPress REST API ⚠ Verify

Limits the REST API to authenticated users only (prevents data exposure)

.htaccess
.htaccess preview
 
⚠ Before applying

Always back up your current .htaccess before replacing it. Test in a staging environment if possible.

Want hosting with cPanel included?

LiteSpeed · Free SSL · DDoS 160 Gbps · 24/7 Support

See Hosting plans →

Frequently asked questions