Generate 301 redirects in bulk

Paste or drop a list of “old address; new address” pairs: the tool writes the .htaccess (Apache) and nginx rules, and flags chains, loops, duplicates and destinations outside the domain. Nothing is sent, everything runs in your browser.

One pair per line, separated by a semicolon, a tab, an arrow (->) or a comma. Paths (/page/) or full addresses. A header line at the top is ignored.

The file is read in your browser (5 MB at most).

Used to spot destinations outside the domain. If empty, the domain of the first full old address is used.

How to use the tool

Paste your list into the text box, or choose a CSV file exported from a spreadsheet. Each line pairs an old address with a new one. Click “Generate the rules”: the findings appear first, then the Apache and nginx rules, which you can copy or download.

Enter the site’s domain if you know it. The tool uses it to spot destinations outside the domain and old addresses that belong to another site. The “Load an example” button fills the list with a chain, a loop, a duplicate and an external destination so you can see each finding.

What the tool writes

For Apache, a page ending in an extension (such as /page.html) gets a “Redirect 301” line. The Redirect directive compares whole path segments and appends the rest of the address to the target: /old-folder would also redirect /old-folder/page.1 For a folder or an address without an extension, the tool therefore writes a RewriteRule that only targets that address.

In an .htaccess file, a RewriteRule pattern is compared to a path without a leading slash, and a pattern starting with “^/” never matches.2 The tool writes “^folder/page/?$”, with an optional trailing slash and the path’s special characters escaped. The R=301 flag makes the redirect, L stops processing, and NE keeps mod_rewrite from re-encoding a target that is already encoded.2

For nginx, the rule is a rewrite directive followed by “permanent”, which returns a 301 code. If the original address carries parameters, nginx appends them to the end of the target, unless the target ends with a question mark.3 A pattern containing a closing brace or a semicolon is put between quotes, as the documentation requires.3

# Apache
Redirect 301 "/old-page.html" "/new-page/"
RewriteEngine On
RewriteCond %{QUERY_STRING} "^id=42$"
RewriteRule "^page\.php/?$" "/catalog/item-42?" [R=301,L]
RewriteRule "^old-folder/product/?$" "https://www.example.com/product/" [R=301,L]

# nginx
rewrite ^/old-page\.html$ /new-page/ permanent;
if ($args = "id=42") { rewrite ^/page\.php/?$ /catalog/item-42? permanent; }
rewrite ^/old-folder/product/?$ https://www.example.com/product/ permanent;

Addresses with parameters

An address such as /page.php?id=42 cannot be redirected with the path alone. In mod_rewrite the pattern does not look at parameters, so you need a RewriteCond condition on %{QUERY_STRING}.2 The substitution then ends with a question mark, which erases the original parameters.2 On the nginx side, the tool tests the $args variable, which holds the request arguments.4

Rules with parameters are placed before the rule for the same path without parameters. The test applies to the string as you wrote it: id=42&lang=en and lang=en&id=42 are two different addresses for the tool. A rule without parameters keeps those of the request, on Apache and on nginx.13

What the tool checks

It looks first for chains: if A redirects to B and B redirects to C, a visitor goes through two hops. Google advises redirecting straight to the final destination, and keeping to 3 hops at most, ideally fewer than 5, when that is not possible.6 With the “Flatten chains” option, each old address points to the final destination.

Next come loops (A to B to A) and redirects to the same address, removed from the result because no browser gets out of them. Exact duplicates are merged. When the same old address has two different destinations, the first line is kept and the other is flagged.

The tool also flags destinations outside the domain, which are normal in a domain change, old addresses from another site, fragments (#) that a browser does not send to the server, and pages sent in bulk to the home page. Google warns that redirecting many addresses to an unrelated page, such as the new home page, may be treated as a soft 404.6

What Google says

The 301 and 308 codes say that a page has moved permanently, and Googlebot treats the destination as the canonical address. Google recommends a permanent server-side redirect whenever possible, and lists the JavaScript redirect among the last resorts.5 For an address change, it asks you to prepare a mapping between each old address and its equivalent, to pick the most relevant destination, to keep redirects for at least a year and to update internal links, canonical tags and sitemaps.6

The tool’s limits

Each line designates a single address: there is no wildcard and no regular expression, so no rule of the type “everything starting with /blog/”. Case matters, as in the Redirect directive.1 The trailing slash is optional for addresses without an extension. The nginx pattern is written with the decoded path (an accent appears as is), while the rewrite documentation does not settle this point: test accented addresses.3

The tool writes rules, it does not test them on your server. Once they are in place, check them with the redirect checker. An .htaccess file is only read if the server allows it: the Redirect directive requires the FileInfo option there.1

After generating

Run a few addresses from the list through the redirect checker to see the real status code and destination. The sitemap validator checks that the new sitemap only lists final addresses. To prepare a whole redesign, read the article on redesigning without losing your rankings.

Frequently asked questions

What is the difference between Redirect and RewriteRule?

Redirect, from mod_alias, compares whole path segments and appends the rest of the address to the target. RewriteRule, from mod_rewrite, matches a regular expression and can test parameters with a condition.12

Should I choose 301 or 302?

A 301 (or 308) says the page has moved for good: Google keeps the destination. The 302, 303 and 307 codes keep the old page in results and suit a short-term situation.5

How long should redirects stay in place?

Google suggests keeping them at least a year after a site move, so that signals and external links pass to the new addresses.6

Why flatten chains?

Each hop adds a request and a risk of error. Google advises redirecting straight to the final destination and not going past 3 hops, ideally fewer than 5.6

Where do I paste the generated rules?

For Apache, in the .htaccess file at the root of the site, or in the server configuration. For nginx, in the site’s server block, then reload nginx.

Sources

The passages of this page and the tool’s checks refer to one of these references, read on October 18, 2026.

  1. Apache HTTP Server 2.4, mod_alias module (Redirect and RedirectMatch directives). httpd.apache.org ↑
  2. Apache HTTP Server 2.4, mod_rewrite module (RewriteRule, RewriteCond, R, L and NE flags). httpd.apache.org ↑
  3. nginx, ngx_http_rewrite_module (rewrite, return and if directives). nginx.org ↑
  4. nginx, ngx_http_core_module (variables $args, $is_args, $request_uri). nginx.org ↑
  5. Google, “Redirects and Google Search”, Google Search Central, updated April 14, 2026. developers.google.com ↑
  6. Google, “Site moves with URL changes”, Google Search Central, updated August 20, 2026. developers.google.com ↑

A redesign or a domain change coming up?

I prepare the address mapping and the SEO migration so that traffic moves to the new pages. I reply within 24 working hours.

Contact me