Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Webflow 301 redirects bulk import
var hostingContainer = document.getElementsByClassName('hosting-tab')[0];
var hostingController = angular.element(hostingContainer);
var scope = hostingController.scope();
var redirects = [
{source: '/old1', target: '/new1'},
{source: '/old2', target: '/new2'},
];
redirects.forEach(function (rule) {
scope.redirectPath = rule.source;
scope.redirectTarget = rule.target;
scope.addRedirect();
});
@todd-g
Copy link

todd-g commented Aug 4, 2022

Webflow must have changed something, these aren't working anymore. It wants path and targetPath now - but I couldn't figure out how to send those properly. Just setting them on scope.path and scope.targetPath didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment