Skip to content

arturseo-geo/redirect-manager-command

Repository files navigation

/redirect — Claude Code Command

Built by Artur Ferreira for thegeolab.net — where we manage 12+ Nginx redirects across a growing content architecture.

Manage Nginx 301 redirects safely — add, list, verify, or remove.

What it does

Replaces ad-hoc sed/python editing of Nginx configs with a structured command:

  • Add: Creates regex-based redirects that handle trailing slash variation
  • List: Shows all active redirects from the Nginx config
  • Verify: Tests every redirect returns 301
  • Remove: Safely removes a redirect without breaking the config

Install

cp redirect.md ~/.claude/commands/redirect.md

Usage

/redirect add /old-slug /new-slug
/redirect list
/redirect verify
/redirect remove /old-slug

How redirects are implemented

Always uses regex to handle trailing slash:

location ~ ^/old-slug/?$ { return 301 /new-slug/; }

Never uses exact match (location =) — it fails on trailing slash mismatch.

Safety rules

  • Always runs nginx -t before reloading
  • Uses systemctl reload (not restart) for zero downtime
  • Verifies both /slug and /slug/ after adding
  • Checks for redirect chains and consolidates

Requirements

  • SSH access to VPS with Nginx
  • Nginx config at a known path

Licence

MIT


A project by The GEO Lab — Generative Engine Optimisation research

About

Claude Code command: Manage Nginx 301 redirects — add, list, verify, remove. Handles trailing slash, regex patterns, safe config editing

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors