.htaccess & Nginx Redirect Generator

Turn old-to-new URL pairs into 301 redirect rules for .htaccess, Nginx, Cloudflare or PHP, with ready-made HTTPS and www rules.

Runs in your browser — nothing you enter is uploaded Free · no sign-up

      

About the .htaccess & Nginx Redirect Generator

Writing redirect rules by hand is tedious and easy to get wrong, especially with special characters or query strings. This .htaccess redirect generator converts a list of old and new URL pairs into 301 rules in the format your server needs: Apache .htaccess using Redirect or RewriteRule, Nginx, a Cloudflare bulk redirects CSV, or plain PHP. It also includes ready-made rules for forcing HTTPS and choosing www or non-www.

The generator runs in your browser, so your URL lists stay on your device. Always back up your existing .htaccess before editing, since a syntax error can take the site offline. After uploading, test a sample of old URLs with the redirect checker or the bulk status code checker to confirm each returns a single 301 to the right page.

How to use it

  1. Paste old and new URL pairs, one pair per line.
  2. Choose the output format: Apache, Nginx, Cloudflare CSV or PHP.
  3. Copy the generated rules, or add the HTTPS and www rules if needed.
  4. Back up your config, apply the rules and test sample URLs.

Frequently asked questions

What is the difference between Redirect and RewriteRule in .htaccess?

Redirect (from mod_alias) is simple: it maps one path to a new URL and suits straightforward one-to-one redirects. RewriteRule (from mod_rewrite) uses regular expressions and conditions, so it can handle patterns, query strings and HTTPS or www rules. Mixing both in one file can lead to unexpected order of processing, so stick to one style where possible.

Where do I add redirect rules on Nginx?

Nginx does not use .htaccess. Redirects go in the server block of your site's configuration file, usually as return 301 or rewrite directives, and you must reload Nginx after changes. On managed hosting you may need to ask support or use the host's redirect panel. Test the configuration before reloading to avoid downtime.

How long should I keep 301 redirects in place?

Keep them as long as practical, ideally permanently. Google has suggested keeping redirects for at least a year so signals are fully transferred, but old URLs may still receive visits from bookmarks and backlinks for much longer. Redirect rules cost very little to keep, so removing them rarely makes sense.