.htaccess Redirect Generator
Generate correct 301/302 redirect rules for Apache — Redirect directives or RewriteRules, plus HTTPS and www blocks.
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.
About this tool
Moving pages without redirects burns SEO and breaks bookmarks. This generator turns a simple old-path new-url list into correct Apache redirect rules — classic Redirect directives or escaped RewriteRule patterns — with optional force-HTTPS and www-normalization blocks.
Every old path is validated so you catch typos before they hit production.
How to use it
- List redirects one per line:
/old-page /new-page. - Pick 301 (permanent, passes SEO value) or 302 (temporary).
- Choose Redirect or RewriteRule style; tick HTTPS/www blocks if needed.
- Paste the output at the top of your .htaccess and test.
Useful ways to apply it
- Redirecting old URLs after a site restructure or migration.
- Forcing HTTPS across an entire shared-hosting site.
- Normalizing www vs non-www to a single canonical host.
- Retiring campaign pages while preserving link equity.
Worked example
Example input
/old-page /new-page
Expected output
A permanent redirect rule from /old-page to /new-page
Edge cases to check
- RewriteRule patterns are relative to directory context.
- Rule order can create loops or shadow later rules.
- Apache modules and host configuration may differ.
Known limitations
Generated rules must be tested on staging and backed up before deployment. Syntax-valid rules can still redirect the wrong traffic.
How this tool was reviewed
Reviewed with path redirects, absolute targets, HTTPS and host canonicalization examples.
Standards and technical references
See the site-wide testing methodology for fixture categories, privacy checks and correction policy.
Frequently asked questions
301 or 302 — which should I use?
Redirect vs RewriteRule?
Where do the rules go?
Privacy
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.