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

Frequently Asked Questions

Related tools

Last updated: 2026-05-29 · Reviewed by Nham Vu