Htaccess Redirect Generator

Paste your old-URL to new-URL pairs, choose 301 or 302, and get ready-to-copy .htaccess redirect directives instantly.

Redirect Pairs

.htaccess Output

Enter redirect pairs on the left and click Generate.

Usage Notes

  • Old paths must start with /. New URLs can be absolute or root-relative.
  • For RewriteRule format, make sure your .htaccess includes RewriteEngine On.
  • Place redirect rules before CMS rewrite rules (e.g. WordPress) in your .htaccess.
  • Lines starting with # and blank lines are ignored.
Copied!

Summary

Paste your old-URL to new-URL pairs, choose 301 or 302, and get ready-to-copy .htaccess redirect directives instantly.

How it works

  1. Enter one redirect pair per line in the format: /old-path /new-url
  2. Choose the redirect type: 301 Permanent or 302 Temporary.
  3. Select the directive format: Redirect or RewriteRule.
  4. Click Generate to produce the .htaccess rules.
  5. Review the output and click Copy to copy it to your clipboard.
  6. Paste the rules into your .htaccess file, below any existing RewriteEngine On directive.

Use cases

  • Redirect old blog post URLs to new paths after a site restructure.
  • Forward traffic from deleted pages to relevant replacement content.
  • Migrate a site to a new domain while preserving SEO link equity with 301s.
  • Temporarily redirect users during maintenance with a 302.
  • Bulk-generate redirect rules from a spreadsheet export of old and new URLs.
  • Consolidate duplicate URLs into a single canonical page.
  • Redirect category or tag pages removed during a CMS migration.
  • Set up vanity URLs that point to longer internal paths.

Frequently Asked Questions

Last updated: 2026-07-01 · Reviewed by Nham Vu