/install htaccess-gen
htaccess-gen
Generate production-ready .htaccess configurations from the command line.
Quick Start
# Generate HTTPS redirect + security headers + caching
python3 scripts/htaccess_gen.py generate --https --security-headers --caching
# Generate redirect rules
python3 scripts/htaccess_gen.py redirect --from /old-page --to /new-page --type 301
# Block IPs
python3 scripts/htaccess_gen.py generate --block-ip 192.168.1.100 --block-ip 10.0.0.0/24
# Full production config
python3 scripts/htaccess_gen.py generate --https --www --security-headers --caching --gzip --error-pages --hotlink-protection --output .htaccess
Commands
generate
Create a complete .htaccess file with selected features.
Options:
--https— Force HTTPS redirect--www— Force www prefix (or--no-wwwto remove it)--security-headers— Add security headers (X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, HSTS)--caching— Add browser caching rules (mod_expires)--gzip— Enable gzip/deflate compression--error-pages— Add custom error page directives (403, 404, 500)--hotlink-protection— Prevent image hotlinking--domain \x3Cdomain>— Your domain name (used for hotlink protection and www rules)--block-ip \x3Cip>— Block an IP address or CIDR range (repeatable)--cors— Enable CORS headers--cors-origin \x3Corigin>— Specific allowed origin (default:*)--index \x3Cfile>— Set directory index file--output \x3Cfile>— Write to file instead of stdout
redirect
Generate redirect rules.
Options:
--from \x3Cpath>— Source path (required)--to \x3Cpath>— Destination path or URL (required)--type \x3Ccode>— HTTP status code: 301 (permanent) or 302 (temporary). Default: 301.
rewrite
Generate URL rewrite rules.
Options:
--pattern \x3Cregex>— Regex pattern to match (required)--target \x3Cpath>— Rewrite target (required)--flags \x3Cflags>— RewriteRule flags (default:[L,QSA])--condition \x3Ccond>— RewriteCond to prepend (repeatable)
Feature Details
Security Headers
Adds these headers via mod_headers:
X-Frame-Options: SAMEORIGIN— Prevents clickjackingX-Content-Type-Options: nosniff— Prevents MIME sniffingX-XSS-Protection: 1; mode=block— XSS filterReferrer-Policy: strict-origin-when-cross-originPermissions-Policy: camera=(), microphone=(), geolocation=()Strict-Transport-Security: max-age=31536000; includeSubDomains(when --https)
Caching Rules
Sets expiry times via mod_expires:
- Images: 1 month
- CSS/JS: 1 week
- HTML: 1 hour
- Fonts: 1 year
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install htaccess-gen - After installation, invoke the skill by name or use
/htaccess-gen - Provide required inputs per the skill's parameter spec and get structured output
What is htaccess Generator?
Generate .htaccess files for Apache web servers. Use when creating redirect rules, URL rewrites, security headers, HTTPS enforcement, IP blocking, caching ru... It is an AI Agent Skill for Claude Code / OpenClaw, with 204 downloads so far.
How do I install htaccess Generator?
Run "/install htaccess-gen" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is htaccess Generator free?
Yes, htaccess Generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does htaccess Generator support?
htaccess Generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created htaccess Generator?
It is built and maintained by John Wang (@johnnywang2001); the current version is v1.0.0.