.htaccess Bulk Redirect Generator

Turn a list of old and new URL pairs into Apache redirect rules for a site migration.

Old URL → new URL (one per line)
Redirect rules
Runs locally in your browser

About the .htaccess Bulk Redirect Generator

A site migration means redirecting every old URL to its new home, and writing hundreds of Redirect lines by hand is where mistakes creep in. This tool takes a list of pairs, old path then new URL separated by a space, comma or tab, one per line, and produces a Redirect 301 (or 302) rule for each. Lines it cannot parse are marked with a comment rather than silently dropped.

The directive comes from Apache mod_alias and its shape is fixed: the status code, then a source that must be an absolute path beginning with a slash, then a destination that may be a path or a full address. Use 301 for permanent moves, which passes search ranking to the new URL and is cached hard by browsers, and 302 only for temporary changes.

Redirect matches by prefix, and that is the rule to hold on to. A line for /blog also catches /blog/2020/post and appends the leftover path to the destination, so a broad rule placed early swallows the specific ones underneath it, and a destination beginning with its own source loops forever. Order narrow paths above broad ones, or move to RedirectMatch with an anchored pattern when an exact match is what you mean.

Paste the result into your .htaccess, above any rewrite rules, and try it on staging first, because a redirect loop takes a site down completely. For the general site rules (HTTPS, www, caching), the .htaccess Generator builds those, and URL Validator catches malformed entries in the list beforehand.

How to use

  1. Paste old and new URLs, one pair per line.
  2. Choose 301 or 302.
  3. Copy the rules into your .htaccess.

Common questions

How should I separate old and new URLs?
With a space, comma or tab. The old path comes first.
301 or 302?
301 for permanent moves (passes SEO value); 302 for temporary redirects.
Should the old URL be a path or a full URL?
A path such as /old-page. The new URL can be a path or a full address.