.htaccess Redirect Generator

Create Apache .htaccess redirect rules for URL migrations, canonical host changes, and HTTP to HTTPS cleanup.

Back up your existing .htaccess file and test redirects before applying rules in production.
Apache .htaccess snippet

        

How to use this tool

  1. Enter the old path and destination path or full URL.
  2. Choose 301 for permanent moves and 302 for temporary testing.
  3. Enable HTTPS or host canonical rules only when they match your server setup.
  4. Back up the existing .htaccess file before applying the generated snippet.

Common mistakes

  • Putting redirect rules below application rewrite rules where they never run.
  • Testing directly in production without a backup.
  • Mixing www and non-www redirects in both Apache and CDN settings.

FAQ

Should I use 301 or 302?

Use 301 for permanent URL moves and 302 for temporary redirects or testing.

Does this replace my full .htaccess?

No. Treat the output as a snippet and merge it carefully into your existing file.

Can this break a site?

Yes, incorrect rewrite rules can cause loops or 500 errors. Back up the file and test carefully.

Related tools

Last updated: May 17, 2026