Skip to main content
Free tool

Redirect generator

An old → new map as .htaccess, nginx or a plain list, locally in your browser

  • Free
  • No account required

One pair per line. Separate with a space, tab, comma or arrow. Lines starting with # are skipped.

Validation

Paste your redirect map

An old URL and a new URL on one line. Validation and generation run locally and nothing is uploaded.

Review before deploying. The rules are anchored, so /old will not also redirect /old/subpage, the usual side effect of a plain Redirect.

.htaccess

Rules appear once you paste a map…

This redirect generator turns a pasted old → new map into .htaccess rules, nginx locations or a plain list. On the way it checks what actually breaks migrations: chains, loops, the same source mapped twice, and pages redirected to themselves. It runs locally and nothing is uploaded.

About the tool

What breaks a URL migration

Chains are what several migrations in a row leave behind: /a goes to /b, /b goes to /c. Every hop is another request and more latency, and a long enough chain can stop a crawler before the end of it. Collapse everything to one step straight to the final URL.

A plain Redirect also covers subpages. Apache matches whole path segments, so Redirect 301 /old /new does not catch /old-pricing, but it does move /old/subpage to /new/subpage. That is why this generator emits an anchored RedirectMatch with ^ and $, which redirects that one address only.

301 redirects do not lose PageRank: Google said so in 2016. Chains are worth shortening for speed and reliability, not because they "leak link equity".

Validation works on the list you paste. The tool fetches nothing, so it cannot tell you whether a target returns 200. Check that separately after deploying.

In practice

Prepare the map before migration

Match each old URL to a page with the same purpose or the closest relevant content. Avoid redirecting every removed page to the homepage. Review loops, duplicates and chains before generating configuration.

Step by step

How to plan 301 redirects for a URL change

You prepare 301 redirects from a map where every old URL has one new counterpart. Five steps take you from a list of URLs to rules checked after deployment.

  1. Collect the old URLs

    Export URLs from your current sitemap, your CMS and the pages report in Search Console. Add URLs that external links point to, because those are the ones most often lost in a migration.

  2. Map each URL to its closest counterpart

    An old URL points to the page with the same content. Google advises against sending many old URLs to one unrelated destination. Merging several pages into one new page is fine.

  3. Paste the map and fix the issues

    The generator above takes old and new URL pairs, one per line. It flags chains, loops, one source mapped to two targets and pages redirected to themselves. Fix them in the map before you copy the rules.

  4. Pick your server format and deploy the rules

    For Apache you get anchored RedirectMatch 301 rules for .htaccess, for nginx location = blocks with return 301, and for a CDN a CSV list. Everything is generated locally in your browser.

  5. Check the live responses

    After deployment, test a few URLs in the redirect checker: the old URL should return 301 and the target 200. Also update internal links, canonicals and the sitemap to the new URLs.

Examples

Redirect rule examples

Rules in the formats this tool generates, plus a shortened chain.

Apache, .htaccess file
RedirectMatch 301 ^/old-pricing/?$ /pricing
RedirectMatch 301 ^/blog/post\.html/?$ /blog/post

^ and $ make the rule match only that one path, with or without a trailing slash.

nginx, exact match
location = /old-pricing {
    return 301 /pricing;
}

The = modifier defines an exact match of the URI. nginx then stops searching other location blocks.

A chain after two migrations
Before
/a    /b
/b    /c
After
/a    /c
/b    /c

Every old URL goes straight to the final URL. Google advises redirecting directly to the final destination.

Common mistakes

Common redirect mistakes

  • A temporary redirect for a permanent change

    Google uses 301 and 308 redirects as a signal that the target should be canonical. 302 and 307 carry no such signal. A plain Apache Redirect rule without a status code returns exactly that 302.

  • Every old URL sent to the home page

    Google advises against redirecting many old URLs to one unrelated destination such as the home page. A user looking for specific content lands on a general page instead.

  • Chains after repeated migrations

    Google recommends redirecting straight to the destination, and for chains ideally no more than 3 hops and always fewer than 5. After each migration, rewrite old rules to point at the new final URLs.

  • Removing rules too early

    Google recommends keeping redirects as long as possible, generally at least one year. Links from other sites and user bookmarks work only as long as the rules do.

  • Redirects in JavaScript

    Google picks them up only if the page renders, and recommends them as a last resort. A server-side rule works on every request.

Numbers and sources

Redirect status codes and Google recommendations

ValueWhat it meansSource
301, 308Permanent redirects. Google treats them as a signal that the target URL should be canonical.Google Search Central, redirects
302, 303, 307Temporary redirects. They do not tell Google that the target should become the canonical URL.Google Search Central, redirects
1 yearMinimum time Google recommends keeping redirects after a URL change.Google Search Central, site moves
Fewer than 5Number of hops a redirect chain should have according to Google, ideally no more than 3.Google Search Central, site moves
302The code Apache’s Redirect directive returns when you give no status.Apache HTTP Server, mod_alias
POST to GETAfter a 301 response to a POST request, the browser may repeat it as GET. A 308 prohibits changing the method.MDN, 301 Moved Permanently

Sources checked:

Glossary

What can go wrong

→→Chain
/a goes to /b and /b goes to /c. It works, at the cost of one extra request per hop.
↻Loop
/a goes to /b and /b goes back to /a. The browser gives up with an error and the URL is unreachable.
2×Duplicate source
The same old URL on two lines with different targets. The first rule wins.
^$Anchoring
Without ^ and $ a RedirectMatch pattern matches anywhere in the path, so /old also catches /old-pricing and /archive/old.
SEO module in Insight

File or code ready? Check the result on the live page

Indexability, metadata and structure, with priorities and a client report.