Redirect Rule Generator

Generate .htaccess and nginx redirect rules for 301 redirects, HTTPS, and www canonicalization.

2 redirects configured

Apache .htaccess (RewriteRule)
RewriteEngine On RewriteRule ^old-page/?$ /new-page [R=301,L] RewriteRule ^blog/old-post/?$ /blog/new-post [R=301,L]
Nginx (return 301)
# Add inside your server { } block location = /old-page { return 301 /new-page; } location = /blog/old-post { return 301 /blog/new-post; }

What this tool does

301 redirects preserve SEO value during URL changes, HTTPS migrations, and www canonicalization.

Generate Apache .htaccess or nginx snippets — paste into server config manually.

How to use it

  1. 1

    Select redirect type: 301, HTTPS force, or www/non-www.

  2. 2

    Enter source and destination URLs or patterns.

  3. 3

    Copy the generated .htaccess or nginx config snippet.

Redirect priorities

HTTPS and www/non-www should redirect in one hop — avoid redirect chains.

Test redirects with curl or browser dev tools after deployment.

Tips

  • Backup existing .htaccess before overwriting.
  • Map old URLs in a spreadsheet before generating bulk redirect rules.

Related tools

All tools →

Frequently asked questions

Should I use 301 or 302 redirects?

Use 301 for permanent moves (domain changes, URL restructures) — it passes most SEO value.

Does this modify my server?

No. This generates config text — you paste it into your server config manually.