← Back to Skills Marketplace
johnnywang2001

htaccess Generator

by John Wang · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
204
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install htaccess-gen
Description
Generate .htaccess files for Apache web servers. Use when creating redirect rules, URL rewrites, security headers, HTTPS enforcement, IP blocking, caching ru...
README (SKILL.md)

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-www to 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 clickjacking
  • X-Content-Type-Options: nosniff — Prevents MIME sniffing
  • X-XSS-Protection: 1; mode=block — XSS filter
  • Referrer-Policy: strict-origin-when-cross-origin
  • Permissions-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
Usage Guidance
This skill appears coherent and limited to generating .htaccess content. Before using: (1) review the generated .htaccess before deploying to production, (2) run the script without elevated privileges and avoid output paths that could overwrite system files, (3) supply your real domain to avoid example.com defaults, and (4) be aware of configuration side-effects (e.g., CORS '*' or HSTS includeSubDomains) which have operational/security implications for your site. If you need stricter assurance, inspect the script locally or run it in an isolated environment first.
Capability Analysis
Type: OpenClaw Skill Name: htaccess-gen Version: 1.0.0 The skill is a straightforward utility for generating Apache .htaccess configuration files. The Python script (scripts/htaccess_gen.py) uses standard libraries to construct configuration strings for redirects, security headers, and caching based on command-line arguments, with no evidence of malicious intent, data exfiltration, or suspicious execution patterns.
Capability Assessment
Purpose & Capability
Name/description (htaccess generation, redirects, rewrites, headers, caching, IP blocks, etc.) align with the included script and declared requirements (no credentials, no external binaries). All requested functionality is provided by the script.
Instruction Scope
SKILL.md instructs running the included Python script with options that map directly to the features. The script prints to stdout or writes to an --output path; this is expected. Note: when used with --output it will write/overwrite the provided path on the filesystem, so review/choose output paths carefully (avoid running as a privileged user or pointing output to sensitive system files).
Install Mechanism
No install spec; this is an instruction-only skill with an included Python script. No downloads, package installs, or external installers are present.
Credentials
The skill declares no environment variables, credentials, or config paths and the code does not read environment variables or secrets. The requested permissions are minimal and proportionate.
Persistence & Privilege
always is false and the skill does not modify other skills or global agent configuration. It can write files when given an --output path (expected behavior for a generator), but it does not persist settings or request elevated/system privileges.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install htaccess-gen
  3. After installation, invoke the skill by name or use /htaccess-gen
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of htaccess-gen. - Generate production-ready .htaccess files from the command line - Supports HTTPS enforcement, www/non-www redirects, security headers, browser caching, gzip compression, custom error pages, hotlink protection, CORS, IP blocking, directory indexes, redirects, and rewrites - Includes options for feature selection and file output - Useful for converting nginx rules to Apache .htaccess format
Metadata
Slug htaccess-gen
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

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.

💬 Comments