301 redirect generator

Paste old and new URL pairs, get redirect rules for .htaccess, Nginx and Next.js.

FreeRuns in your browserNo signupUpdated 2026-10-29

Every rule matches the exact old path only, so /about does not also catch /about-us. Use the final URLs so there is one hop, and test with curl -I after deploying.

Redirects

4

301 · 0 to another domain

Checks

No problems

Sources are unique and absolute

.htaccess (Apache)
RewriteEngine On
RedirectMatch 301 ^/old-about\.html$ /about
RedirectMatch 301 ^/services/web-design-company$ /services/web-design
RedirectMatch 301 ^/blog/2019/redesign-tips$ /blog/website-redesign-tips
RewriteCond %{QUERY_STRING} ^id=42$
RewriteRule ^products$ /products/indigo-throw? [R=301,L]
nginx.conf (inside server block)
location = /old-about.html { return 301 /about; }
location = /services/web-design-company { return 301 /services/web-design; }
location = /blog/2019/redesign-tips { return 301 /blog/website-redesign-tips; }
if ($request_uri = "/products?id=42") { return 301 /products/indigo-throw; }
next.config.ts
// next.config.ts
const nextConfig = {
  async redirects() {
    return [
      { source: "/old-about.html", destination: "/about", permanent: true },
      { source: "/services/web-design-company", destination: "/services/web-design", permanent: true },
      { source: "/blog/2019/redesign-tips", destination: "/blog/website-redesign-tips", permanent: true },
      { source: "/products",
        has: [{ type: "query", key: "id", value: "42" }], destination: "/products/indigo-throw", permanent: true }
    ];
  },
};

export default nextConfig;

About this tool

How it works and how to read the result.

Need this done for you?

Website redesign & migration

Rebuild an outdated site without losing content or search rankings.

See the service

What it does

An htaccess redirect generator takes a list of old and new URL pairs and writes the redirect rules for three common setups: Apache .htaccess, Nginx server blocks and the redirects array in a Next.js config. Each line is checked so the source is an absolute path, duplicates are caught and chains, where a destination is itself redirected, are flagged. Query string sources such as /products?id=42 are handled with the matching conditions each server needs.

How to use it

  1. Paste the pairs, one per line, as "/old -> /new". A spreadsheet export with two columns pasted as tab-separated text also works.
  2. Choose 301 for a permanent move, which is the usual case.
  3. Check the stats for skipped lines or chains and fix them in the list.
  4. Copy the block for your server and deploy it.
  5. Test a few old URLs with curl -I and confirm the status and Location header.

How to read the result

The Redirects stat shows how many valid rules were produced. Four lines pasted with one duplicate source gives "3" and the Checks badge reports the skipped line so you can see which one. If one destination is also listed as a source, the badge says "1 chain" and the hint tells you to point the first rule straight to the final URL.

The .htaccess block uses RedirectMatch with an anchored pattern for plain paths, so each rule matches one exact URL, and switches to RewriteCond and RewriteRule for sources with a query string, since RedirectMatch cannot see those. The Nginx block uses exact-match locations, so /services/web-design-company will not also catch /services/web-design-company-london. The Next.js block is a full next.config.ts with permanent set to true for 301 and false for 302.

After deploying, a curl -I request to an old URL should return the chosen status and a Location header pointing to the new path, with no further hops.

Clean slugs for the new URLs can come from the URL slug generator. Redirect maps for a whole site are a standard part of our website redesign service.

Questions

Frequently asked.

301 or 302: which one do I need?

301 when the old URL is gone for good, which is almost always the case after a redesign. It tells Google to transfer the old page's ranking signals to the new one. 302 means the move is temporary and the old URL should stay indexed. Use it for short promotions or A/B tests only.

What is a redirect chain and why does it matter?

A chain is when /a redirects to /b, which redirects to /c. Each hop costs time and Google follows only a limited number of them. The checker flags any source that is also a destination. Fix it by pointing /a straight at /c, and keep the /b rule for links that still use it.

Where do the Nginx rules go?

Inside the server block for the domain, before the main location / block. Then run nginx -t to check the syntax and reload. The exact-match location = form is fastest and will not accidentally catch longer paths that begin with the same text.

Your next move

Like what you see? Tell us about it.

A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.

India · Working with clients worldwide

We reply within a working day. No spam, ever.