Skip to content

Nginx Redirect Generator

Build nginx rewrite and return rules from a redirect map.

Quick Tool Overview

The Nginx Redirect Generator writes redirect configuration in the three shapes nginx supports — individual location blocks, return directives, and a map block — and recommends which to use based on how many redirects you have. Past about twenty, a map is the only sensible option, because location blocks are checked in order on every request.

What it does
Generates nginx redirect configuration from a URL map
You give it
One "old path, new URL" per line
You get back
Location blocks, return rules or a map block
Best for
Migrations on nginx, and large redirect sets in particular
SEO Tools Free, unlimited use No sign-up Runs in your browser

About the Nginx Redirect Generator

Paste your redirect map and the generator writes nginx configuration in whichever of the three shapes fits: individual location blocks for a handful of redirects, return directives inside a server block, or a map block for hundreds.

The map block is the one worth knowing about. nginx evaluates location blocks in order, so a configuration with five hundred of them is slow on every request, not just the redirected ones. A map is a hash lookup: it is compiled once at startup and costs the same whether it holds ten entries or fifty thousand. Past about twenty redirects it is the only sensible choice, and the generator switches to recommending it automatically. It also reminds you that a map block goes in the http context, not inside server, which is where most first attempts fail to start.

Key features of the Nginx Redirect Generator

Map blocks for scale

A hash lookup compiled once at startup, costing the same at ten entries or fifty thousand.

Context guidance

A map goes in http, not server. That single fact is why most first attempts fail to start.

Three output shapes

Location, return and map, from the same input, so you can see what each looks like.

Chains and loops checked

The same flattening and loop detection as the Apache generator.

Reload reminder

It tells you to run nginx -t first, because a syntax error on restart takes the server down.

How to use the Nginx Redirect Generator

  1. 1

    Paste your redirect map

    One per line as "old path, new URL". Full URLs are reduced to paths where they need to be.

  2. 2

    Pick the output shape

    Location blocks, return rules or a map block. The tool recommends one based on how many you have.

  3. 3

    Copy the configuration

    A map block goes in the http context; location and return go inside the server block.

  4. 4

    Test before reloading

    Run nginx -t first. A syntax error there takes the whole server down rather than one rule.

Frequently asked questions

Past about twenty redirects. nginx checks location blocks in order on every single request, so a long list slows everything down. A map is a hash lookup compiled once at startup, and it costs the same at ten entries or fifty thousand.

Reviews of the Nginx Redirect Generator

What people who use the Nginx Redirect Generator think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the Nginx Redirect Generator. It takes half a minute and no account.

Write the first review

More SEO tools