Brad Farleigh

Freelance wordpress websites
Perth, Australia

Freelance Wordpress Developer - Perth

How to bulk import 301 redirects to Webflow


It’s rediculous that Webflow – with all it’s bells and whistles still doesn’t allow us a simple way to bulk-import 301 redirects.

As a workaround, you will need to jump over to to the “Publishing” tab in your site settings, adjust the redirects[] array in the function below, then run the code in your browser console (like shown here).

var hostingContainer = document.getElementsByClassName('publishing-tab')[0];
var hostingController = angular.element(hostingContainer);
var scope = hostingController.scope();

// Update your sources and targets here
var redirects = [
  {source: '/old-url-1', target: '/destination-url-1'},
  {source: '/old-url-2', target: '/destination-url-2'},
];

redirects.forEach(function (rule) {
  scope.redirectPath = rule.source;
  scope.redirectTarget = rule.target;
  scope.addRedirect();
});

Help – I get a “Uncaught TypeError: Cannot set properties of undefined (setting ‘redirectPath’)”

If you get this error it means that you are on the wrong tab, use the code above and make sure you are on the “Publishing” tab