Skip to content

301 Redirect Generator: htaccess, Nginx, Netlify

301 redirect generator: turn old and new URL pairs into ready-to-paste rules for Apache .htaccess, Nginx, Netlify, Cloudflare Pages, and Vercel.

By Updated Runs in your browser

Redirect Generator guide

Paste old and new URLs, one pair per line, pick your server or host, and copy bulk 301, 302, 307, or 308 redirect rules. Built for site migrations, renamed pages, and URL cleanups.

What the generator does

Each line is one redirect: the old URL first, the new URL second. You can separate them with a space, a comma, a tab (straight from a spreadsheet), or an arrow like ->. If the old URL includes https:// and a domain, the generator strips it down to the path, because server rules match on the path. Lines with only one URL are skipped and reported, and any rule that points at itself is flagged as a loop.

Pick your server and the status code, then copy the output. Netlify and Cloudflare Pages share the same _redirects format, a plain text file in your publish directory. Apache uses one Redirect line per URL in .htaccess. Nginx gets an exact-match location block per URL. Vercel gets a redirects array for vercel.json.

Which status code to choose

301 Moved Permanently is the right answer for almost every SEO redirect: a renamed page, a merged article, a new domain, HTTP to HTTPS. Google treats it as a strong signal to swap the old URL for the new one in search results.

302 Found is temporary. Use it for a short sale page, an A/B test, or a maintenance detour, when you want the old URL to keep ranking. If a 302 stays in place for months, Google may start treating it as permanent anyway, but do not rely on that.

307 and 308 are the strict versions of 302 and 301. They guarantee the browser repeats the same HTTP method, which matters for forms and APIs that receive POST requests. Vercel's permanent flag produces 308 by default; choose 301 here to force a classic 301 instead.

Worked example: a blog restructure

You are moving posts from dated URLs like /blog/2023/launch to flat ones like /blog/launch, and retiring /pricing.html for /pricing. Paste three lines: "/old-page /new-page", "/blog/2023/launch /blog/launch", and "https://example.com/pricing.html /pricing". Choose Apache and you get: Redirect 301 /old-page /new-page, Redirect 301 /blog/2023/launch /blog/launch, and Redirect 301 /pricing.html /pricing.

Switch to Nginx and the last rule becomes: location = /pricing.html { return 301 /pricing; }. The = means exact match, so it will not accidentally catch /pricing.html.bak or anything longer.

For hundreds of URLs, export old and new columns from a spreadsheet, paste them in, and the tab between columns is handled automatically.

A migration checklist

Before launch, crawl the old site and export every URL that has traffic, backlinks, or rankings. Your analytics landing-page report and the Pages report in Google Search Console are the two lists that matter most. Map each one to its closest new equivalent, not to the homepage. Google treats mass redirects to an irrelevant page, especially the homepage, as soft 404s, and the ranking value is lost.

After launch, test a sample of old URLs with curl -I or your browser's network tab and confirm a single 301 hop to a 200 page. Update internal links and your XML sitemap to point directly at the new URLs, so crawlers are not spending time on redirects. Google recommends keeping redirects for at least one year.

Common redirect mistakes

Chains: A to B to C. Each hop slows users, and Googlebot follows at most 10 hops. When you redirect B to C, also update A to go straight to C.

Loops: A to B and B back to A, or a rule that matches its own destination. The browser gives up with "too many redirects". The generator flags the obvious self-redirects, but test the full set after deploying.

Trailing slashes and case. /Page and /page are different URLs on Apache and Nginx, and /about is not /about/. Include the versions that actually received traffic.

Redirecting with JavaScript or meta refresh when a server redirect is possible. Google can follow them, but server-side 301s are faster and the clearest signal.

How we calculate: sources

Frequently asked questions

What is the difference between a 301 and 302 redirect?

A 301 says the page moved permanently, so search engines replace the old URL with the new one in their index. A 302 says the move is temporary and the old URL should stay indexed. Use 301 for migrations and renamed pages.

Do 301 redirects pass SEO value?

Yes. Google confirmed in 2016 that 30x redirects, including 301 and 302, no longer lose PageRank. Keep redirects in place for at least a year after a migration so signals fully transfer.

When should I use 307 or 308 instead?

308 is a permanent redirect that keeps the request method, so a POST stays a POST. 307 is the temporary version. For normal page links there is no SEO difference between 301 and 308.

How do I write a 301 redirect in .htaccess?

Add one line per page: Redirect 301 /old-page /new-page. It needs Apache's mod_alias, which is enabled on almost all shared hosts. Place it near the top of the .htaccess file in your site root.

What is a redirect chain and why avoid it?

A chain is when URL A redirects to B, which redirects to C. Each hop adds latency, and Googlebot follows up to 10 hops before giving up. Point every old URL straight at its final destination.

Can I redirect a full URL with a domain?

The source side of a rule should be a path, so the generator strips https://domain from old URLs automatically. The destination can be a path or a full URL on another domain.

Is data uploaded?

Everything runs in your browser. Nothing you enter is uploaded to a server or stored by us.

Where do I put the _redirects file?

In the folder your site is published from, such as public/ in Astro or Vite projects, so it ends up at the root of the deployed site. Netlify and Cloudflare Pages read it automatically on deploy.

How many redirects can Cloudflare Pages handle?

Cloudflare Pages allows up to 2,000 static redirects and 100 dynamic redirects in _redirects. For more, use Bulk Redirects in the Cloudflare dashboard.