Skip to content
ToolMug

301 Redirect Generator

Moving to a new site structure or a new domain? Paste your old and new URLs — two columns from a spreadsheet work — and get redirect rules for your server in one go. The generator also checks the list for redirect chains, loops and URLs that point to two different places, the mistakes that cost rankings after a migration.

Runs in your browser — nothing you enter is uploaded

One per line: old path, then new path or full URL, separated by a space, tab or comma. Lines starting with # are ignored. You can paste two columns from a spreadsheet.

4 rules

Put the lines inside the server { } block, then run nginx -t and reload.

Use 301 or 308 for moved pages so search engines transfer rankings to the new address. Avoid chains: every extra hop slows the page and wastes crawl budget.

How to use

  1. Paste one redirect per line — old path, then new path or full URL.
  2. Choose your server and the status code (301 for permanent moves).
  3. Fix any chains, loops or duplicates the tool reports.
  4. Copy or download the rules and add them to your server configuration.

Options explained

301 / 308
Permanent. Search engines move rankings to the new URL. 308 also keeps the request method (POST stays POST).
302 / 307
Temporary. The old URL stays indexed.
Nginx (map)
A lookup table that stays fast with hundreds or thousands of redirects.

One input, five outputs

Each line is an old path followed by a new path or full URL, separated by a space, tab or comma. Lines starting with # are ignored. Take these two lines with 301 and the domain example.com:

/old-page /new-page
/blog/2019/post https://example.com/articles/post

Nginx

location = /old-page { return 301 /new-page; }
location = /blog/2019/post { return 301 https://example.com/articles/post; }

Apache .htaccess

RedirectMatch 301 ^/old-page$ /new-page
RedirectMatch 301 ^/blog/2019/post$ https://example.com/articles/post

Caddy

example.com {
    redir /old-page /new-page 301
    redir /blog/2019/post https://example.com/articles/post 301
}

Cloudflare (one CSV line per rule, no header: source, target, status code)

example.com/old-page,https://example.com/new-page,301
example.com/blog/2019/post,https://example.com/articles/post,301

Nginx (map) produces a map $uri $redirect_to block for the http section and a short if block with return 301 $redirect_to for the server section. If you also add /a /b and /b /c to the list, the checker reports the chain /a → /b → /c and suggests pointing /a straight to /c.

Frequently asked questions

What is a redirect chain?

A → B → C. Each hop slows the page and wastes crawl budget, so point A directly to C.

Why does Apache use RedirectMatch instead of Redirect?

Redirect matches prefixes, so /old would also redirect /old-page. RedirectMatch with ^ and $ matches the exact path only.

Do these rules handle query strings?

They match the path. Query strings are passed through by most servers, but a rule for a specific ?id=1 needs extra conditions, so the tool warns about such lines.

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools