Bulk Redirect Generator

Turn a list of old and new URLs into redirect rules for .htaccess, Nginx, PHP and more. One paste, every rule shipped.

Bulk Redirect Generator

Enter your old and new URLs, pick a platform, and get ready-to-deploy redirect rules.
Build the list one old → new row at a time, upload a CSV/TXT file to import it, and copy the code without touching a config template.


Load an example

List: 1 redirect
Settings
The platform the generated rules are written for.
301 tells search engines the move is permanent; 302 keeps the old page indexed.
Given to rows that list only an old URL after a file import, so single-column imports still produce rules.
Ready to turn your URL list into redirect rules.

Redirect Rules

Overview

A redirect tells the server: anyone asking for this old page should be sent to that new page instead. Every website that has ever renamed a page, retired a product or changed its domain needs a list of these rules, and writing each one by hand in your server's own syntax is slow and easy to get wrong.

This "Bulk Redirect Generator" does the repetitive part for you. Paste a list of old and new URLs – one mapping per line, straight from a spreadsheet, a CSV export or typed by hand – choose where the rules will live, and the tool writes every rule in that platform's exact syntax.

It generates 301 permanent and 302 temporary redirects for Apache (.htaccess), Nginx, PHP, ASP and ASP.NET, plus JavaScript and HTML meta-refresh redirects for pages where server config is out of reach, and CSV/JSON exports for moving your mapping list between systems. It is useful when relaunching a site: visitors with old bookmarks land on the right page, search engines transfer the ranking signals of the original URL, and the 404 log stays quiet. Like every tool on this site, it runs entirely in your browser with JavaScript – your URL lists are never uploaded anywhere.


How to Use This Tool

1. Add your redirects: Fill the two boxes of the first row – the old URL on the left, the new URL on the right – and press "Add another redirect" for each further pair; the plus button keeps appending rows, so the list grows to exactly the redirects you need. You can also upload a .txt/.csv file to import whole mapping lists, or start with "Load an example".

2. Pick your platform: Under "Settings", choose the "Redirect Format" – .htaccess, Nginx, PHP, JavaScript, meta refresh, ASP, ASP.NET, CSV or JSON – together with the "Redirect Status" for the formats that use one.

3. Generate: With "Live mode" on (the default), the code in the "Generated Code" field follows every row and setting change by itself. With Live mode off, press "Generate Rules" whenever you are ready. Empty rows are ignored, and skipped or duplicate entries are reported in the message below the settings.

4. Take the code: Use "Copy" to move the rules onto your clipboard, or "Download" to save them with the right file name for the chosen format (redirects.htaccess, redirects.conf, redirects.php and so on). "Clear & Reset" empties everything back to the defaults.


Examples

Click "Try it" on any example below and it loads straight into the mapping rows and generates the code at once – the code on the right of each example is exactly what you will see.

Example 1 – Apache .htaccess, 301 permanent
Input mappings
/trainees-guide /docs/trainee-guide
/old-blog/autumn-run-club /blog/autumn-run-club
/coach-bios /about/coaches
Generated Code (.htaccess)
# 301 Redirects generated by TextToolz
Redirect 301 /trainees-guide /docs/trainee-guide
Redirect 301 /old-blog/autumn-run-club /blog/autumn-run-club
Redirect 301 /coach-bios /about/coaches
Example 2 – Nginx return blocks
Input mappings
/chess-club /clubs/chess
/rink-timetable /clubs/rink-timetable
Generated Code (nginx)
location = /chess-club { return 301 /clubs/chess; }
location = /rink-timetable { return 301 /clubs/rink-timetable; }
Example 3 – Bulk CSV import
Input mappings
/team-photo, /about/team
/pool-hours, /pool/hours
/insurance-faq, /about/insurance-faq
Generated Code (CSV, comma separator)
/team-photo,/about/team
/pool-hours,/pool/hours
/insurance-faq,/about/insurance-faq
Example 4 – PHP header redirects
Input mappings
/weekend-rally /events/weekend-rally
/old-price-list /docs/price-list-current
Generated Code (PHP)
<?php
// Rule 1
if ($_SERVER['REQUEST_URI'] === '/weekend-rally') {
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: /events/weekend-rally");
    exit();
}
// Rule 2
if ($_SERVER['REQUEST_URI'] === '/old-price-list') {
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: /docs/price-list-current");
    exit();
}
?>

Features & Options

Nine output formats: Apache .htaccess opens with a comment line and writes one Redirect 301 rule per mapping (a full URL in the old column is trimmed to its path and query automatically); Nginx writes one location = /old { return 301 ...; } block per mapping; PHP wraps your rules in a <?php ?> block with a commented header() branch per mapping; JavaScript writes one window.location.replace check per mapping; HTML meta refresh emits a comment plus a bare <meta http-equiv="refresh"> tag ready to paste into the old page; ASP wraps its conditional Response.Status branches in a <% %> block; and CSV/JSON give your mapping list back in clean, importable form.

301 or 302 status: Applies to .htaccess, Nginx, PHP, ASP and ASP.NET. 301 is permanent and transfers search ranking to the new URL; 302 is temporary, so the old URL keeps its place. The dropdown hides itself for the formats that have no status code.

Default Target: With single-column imports, any row that lists only an old URL is paired with this URL, so a list of retired pages can still produce rules – each one landing visitors on your chosen fallback page.

Bulk import: "Upload a file" reads .txt, .csv and .rtf files straight into the list, one mapping row per line. The import detects tabs, commas, semicolons, pipes and spaces on its own, so exported spreadsheets and link-audit reports land in the rows in one go.

Row-by-row reporting: The result message counts your rules and names what happened to every row it could not use – a row missing its old URL, or a single-column import with no default target, is skipped with its number, and duplicates collapse to the last one.

Live mode: On by default. Every row you fill, remove, import or change – and every setting change – rewrites the generated code instantly, so you can watch the rules take shape while you type. Turn the switch off to keep the code frozen until you press Generate Rules.

Copy / Download / Clear & Reset: Copy puts the generated code on your clipboard, Download saves it with a platform-appropriate filename, and Clear & Reset restores every setting to its default.


How this tool can be Useful?

Site relaunches and redesigns: When a website changes its URL structure, a bulk .htaccess file preserves every inbound link – search results, press mentions and old bookmarks – instead of sending those visitors to a 404.

Protecting hard-won rankings: Pages that rank today did not rank yesterday. A 301 rule tells search engines the ranking belongs to the new address, so a rename or platform move does not reset your SEO to zero.

Merging content: When two articles become one, the retired URL points at its replacement, readers following old links still arrive, and all the historical traffic and link equity flows into the surviving page.

Consultants and agencies: Client projects often cover several stacks – one site on Apache, the next on Nginx, a legacy app in PHP or ASP.NET. Generating the same mapping sheet into each platform's syntax keeps the whole migration consistent.

Developer share-out: CSV and JSON output turn a messy mapping spreadsheet into a structured file that a developer, a CMS importer or a redirect plugin can consume directly, or that the CSV round-trips back into this tool later.


FAQs

FAQ 1: Where does each generated file belong?
Answer: redirects.htaccess goes into your site's web root (requires the Apache mod_alias module), redirects.conf belongs inside the server block of a Nginx site config, and redirects.php holds ready-to-use conditionals to place at the top of your PHP entry point. Meta-refresh and JavaScript versions belong on the old pages themselves.

FAQ 2: 301 or 302 – which should I choose?
Answer: Use 301 when the move is permanent: search engines transfer the old page's ranking signals to the new one. Choose 302 when the change is seasonal or reversible, such as a temporary maintenance page, because search engines keep the old URL indexed.

FAQ 3: What if an uploaded file has odd formats?
Answer: The import accepts two columns in many shapes – separated by tabs, commas, semicolons, pipes or spaces – and quoted cells survive the split, so "/my path","/my new path" stays one mapping. No configuration is needed; just upload the file and the rows appear.

FAQ 4: What happens to imported rows with only the old URL?
Answer: They are paired with the "Default Target" URL. With no default target set, the row is skipped and reported by number so you can correct the import instead of receiving silent gaps.

FAQ 5: Can the tool generate thousands of rules at once?
Answer: Yes. Every input line is processed independently, so bulk exports from spreadsheets or audit reports can be turned into a complete rule set in one click. For very large deployments, watch your hosting provider's limits on .htaccess size and consider Nginx for faster rule matching.

FAQ 6: Are my URLs sent to a server?
Answer: No. The generation runs entirely in your browser with JavaScript, and nothing is uploaded or stored.


Tools Worth Trying

TextToolz

The Ultimate Text Tools

TextToolz works seamlessly to let you convert and design your text. It is fast, reliable and secure. Trusted by thousands of users.