WEBFLOW UPDATE!
As of June 2024, Webflow has added bulk import & export redirect support natively. Note some important limitations on import here.
My original post is remains here for historical purposes, and tech value;
Fair warning- this is a total hack.
But, it might just save you hours of time, when you need it.
In 2020, Janne Kanerva shared a technique for bulk importing 301 redirects in Webflow. It has proven very useful, and although the original technique no longer works properly, it was updated in 2022 by Laura North in a comment I found here.
Recently I had a client who needed some major rework on their redirects table, which means I needed to export everything, change it, and then re-import.
But... CSV export is not a feature either.
My solution is based on Janne's technique, with Laura's modifications, redone to export rather than import.
The Export Script
Here’s how to use it;
- Using Google Chrome, login to Webflow
- Go to your site's settings, to the publishing tab where you see the redirects list.
- Open Chrome dev tools CTRL+SHIFT+I
- Go to the console
- Paste this script and press ENTER
Jun-2023: Sam Pilgrim posted that some UI changes have broken the scripts below, and offers an alternative script.
// Create CSV
var hostingContainer = document.getElementsByClassName('redirects')[0];
var hostingController = angular.element(hostingContainer);
var scope = hostingController.scope();
var csv = `"Source","Dest"\r\n`;
scope.redirects.forEach(function (rule) {
csv += `"${rule.src}","${rule.target}"\r\n`;
})
console.log(csv);
// Export as a file
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv);
hiddenElement.target = '_blank';
hiddenElement.download = 'redirects.csv';
hiddenElement.click();
You'll see a file save dialog open, where you can name and save your CSV results.
If the file-creation step doesn’t work for you, you’ll see the CSV in the console as well and can copy paste the CSV content manually.
Check Your Results
I haven’t tested this on a very large set of redirects, hopefully it will get all of them.
Anyone who uses this, please let me know if it worked for you, and how many redirects you exported. I’m very curious to know how smoothly it works on a large list.
Thanks!