BV
All tools
seo

301 Redirect Rule Generator

Turn a list of old and new URLs into redirect rules for Apache htaccess, Nginx, Cloudflare or Netlify. Detects redirect chains and loops before you deploy them, and handles bulk migrations from a pasted list.

Muhammad Bilal
Muhammad Bilal Virk
4 min read
Redirect map generator
Redirects
3
Problems
0
Chains detected
0
Redirect rules
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^old-blog/post-one/?$ /blog/post-one [R=301,L]
  RewriteRule ^services/automation/?$ /services [R=301,L]
  RewriteRule ^tools/zapier/?$ https://bilalvirk.com/tools/zapier-cost-calculator [R=301,L]
</IfModule>
Redirect chains are the quiet killer in a migration. Every hop adds latency and Google gives up following after roughly five, so a chain of old → older → newest wastes the link equity you moved the pages to preserve. Flatten every chain to a single hop pointing straight at the final URL before you deploy, and keep the rules in place for at least a year.

Site migrations lose traffic in the redirect map, not in the design. Paste your old and new URLs as a two-column list and get deploy-ready rules for your server, with redirect chains and loops flagged before they reach production.

What this tool does

Paste a list of URL pairs — old on the left, new on the right, one per line — and choose your platform. You get a rule block for Apache .htaccess, an Nginx server block, Cloudflare bulk redirect rows, or a Netlify _redirects file.

Before it emits anything it checks the map for two problems that only surface after deployment: chains, where A redirects to B and B redirects to C, and loops, where the map eventually points back at itself. Both are listed with the exact lines involved.

A worked example

Paste:

text
/old-blog/automation-guide  /blog/workflow-automation
/blog/workflow-automation   /blog/what-is-workflow-automation

The tool flags a chain. Any request for the first URL takes two hops, which costs latency and, on a large map, adds up to a genuine crawl budget problem. The fix it suggests is to rewrite the first rule to point straight at the final destination, collapsing two hops into one.

It also spots the trailing-slash trap: a rule redirecting /page to /page/ on a server that already appends the slash produces an infinite loop.

Output formats

Platform Format produced
Apache Redirect 301 or RewriteRule inside .htaccess
Nginx return 301 inside a location block
Cloudflare Source and target rows for a bulk redirect list
Netlify _redirects lines with the status code

Where people go wrong

Redirecting everything to the homepage. It is the fastest way to throw away the value of an old URL. Google treats a redirect to an irrelevant page as a soft 404. Map each URL to its closest equivalent, and let the ones with no equivalent return a proper 410 or 404.

Using 302 for a permanent move. A 302 says "this is temporary, keep the old URL indexed". For a migration you want 301. Google's redirect documentation sets out which status code signals what, and the underlying semantics are defined in RFC 9110.

Leaving chains in place after a second migration. Two migrations in three years and every old URL is three hops from its destination. Flatten the map each time rather than layering rules.

Redirecting to a URL that is not canonical. The target should be the canonical URL, and it should return 200. Build the two together with the canonical tag generator.

Deleting the old sitemap immediately. Keep it live for a few weeks. It is how Google finds the old URLs in order to discover the redirects.

FAQ

301 or 308?

301 for almost everything. A 308 preserves the request method, which matters for POST endpoints and almost never for content URLs. Search engines treat both as permanent.

How long should redirects stay in place?

At least a year, and there is rarely a good reason to remove them at all. External links to the old URL do not expire.

Do redirects lose ranking value?

Google has stated for years that PageRank is not diluted through 301 redirects. What does cost you is the chain, the mismatch between old and new content, and the mistake of pointing everything at one page.

Can I redirect with query strings?

Yes, but the syntax differs by platform. Apache needs RewriteCond %{QUERY_STRING}; Nginx matches on $args. The generator emits the correct form for the platform you select.

Should I redirect http to https and www to non-www?

Yes, and do it once at the server level rather than per URL, so a single rule handles the whole site. Then make sure your canonical tags reflect the chosen version.

Next steps

After deploying, confirm nothing important is now blocked using the robots.txt tester, regenerate your sitemap with the new URLs, and re-check the head on key pages with the On-Page SEO Auditor.

If the migration is part of a larger systems change, API Automation for Businesses covers keeping the tools around the site in sync.

Migrating a site with thousands of URLs? Book a discovery call.

Muhammad Bilal
Muhammad Bilal Virk
AI automation engineer — building agents, workflows, and RPA that remove repetitive work.
Share
Newsletter

One email, when I ship something worth reading.

No cadence, no filler. Unsubscribe any time.

Free consultation

Want this built against your real numbers?

A 30-minute call to scope the workflow, agent, or automation you actually need.

Book a free consultation

More seo tools

All tools
Next step

Have a workflow that's burning hours every week?

Bring me one real bottleneck. I'll tell you whether it's worth automating, and what it would take.

Book 30 Minutes Call