This Node.js script checks a CSV list of redirects for issues like redirect loops, chains, and invalid destinations. It also validates destination URLs to ensure they're reachable (HTTP 200), and outputs cleaned results and error logs.
- 🧼 Cleans duplicate redirects
- 🔁 Flags and removes redirect loops (e.g.
/about → https://example.com/about
) - 🔗 Detects redirect chains (e.g. A → B → C)
- 🌐 Optionally validates destination URLs
- 📝 Exports:
output/<filename>.csv
– cleaned list with issues removed (no headers)output/redirect-errors.csv
– any destination not returning HTTP 200
Make sure you have Node.js installed on your machine.
This script uses built-in Node modules, so no installation required — ready to run out of the box!
Ensure your CSV follows this format (no header row):
/about-us,/contact
/old-page,/new-page
Each line must have:
- Column 1 = source path
- Column 2 = destination URL or path
Open run.bat
on Windows or run.command
on Mac OS
You'll be prompted to enter the path to your CSV (e.g., example.csv
).