Skip to content

Instantly share code, notes, and snippets.

Last active August 4, 2023 13:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Bulk Delete 301 Redirects From Webflow
const deleteRedirects = async (redirects) => {
const xsrfToken = document
const shortName = window.location.href.split('/')[5];
for (const path of redirects) {
const bodyContent = JSON.stringify({ path });
try {
await fetch(
headers: {
'content-type': 'application/json',
'x-xsrf-token': xsrfToken,
body: bodyContent,
method: 'POST',
console.log(`Deleted redirect: ${path}`);
} catch (error) {
console.error(`Error deleting redirect: ${path}, ${error}`);
const redirectsToDelete = ['/first-slug', '/second-slug'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment