Redirecting some pages from root directory to subdirectory

Hi there!

We’re moving our website from Wordpress to Webflow, and need to redirect our old news posts to their new URLs, as well as some other static pages.

The website includes 40 or so static pages, and the rest (200+) is all news/blog posts.

Unfortunately, our news posts are not currently set up in a subdirectory on Wordpress, so their URLs all look like “domain.com/slug-of-the-new-item” rather than “domain.com/news/slug-of-the-news-item

We’ve imported the news items into a CMS collection on Webflow, and their Webflow slugs are identical to their WP ones, so it should (theoretically) just be a matter of redirecting all pages in the root folder to /news/corresponding-slug, with the exception of the other 40 or so static pages.

Some of these static pages need to be redirected to updated URLs, some won’t change.

My thoughts were:

  1. Set up redirect rules for all static pages first (fairly straight-forward)
  2. Set up a redirect for all other pages in the root folder /(.*) to point to news/%1

Two problems with point #2 is that

  1. it creates a redirect loop (since news/… would forever point to news/news/…), and
  2. it also would also match some of the static pages that don’t need to be redirected (e.g. domain.com/contact will remain the same on Webflow, but under this rule, would be directed to new/contact)

Questions:

  1. Is there a better way to go about setting up redirects for our website than the steps I outlined above?

  2. If not, how could I go about using wildcards to set up these redirects on Webflow? Does Webflow also support more complex regex expressions?

I found a similar issue here (Move from WordPress to Webflow without losing SEO or causing 404 - #13) but the topic was closed without a solution.

Cheers,

Yasmina

Take look at the 301 rederiction in the Webflow settings

Here is a link

Thanks, Janne! I have already looked at the Webflow uni for help but am stumped by my particular case, and the information on the link hasn’t helped so far.

It’s looking like I won’t be able to set up redirects using a rule but instead will have to do 200 or so unique redirects to cover most, if not all, of our blog posts, which is not ideal.

Unless someone else has figured out a way to go around this?

Ok i se your problem now. Word Press is all in the root. if you can’t find a clever solution to this i think the best is to go to Google Search Console and delete all old records in Search Console.

This is a tricky one sugest you speak with the support

1 Like

Thanks, @JanneWassberg, I’ll shoot support a message!

the right thing to do is create 200+ redirects, which is an annoying and also common problem

there is a feature request for bulk upload of 301 redirects
https://wishlist.webflow.com/ideas/WEBFLOW-I-775

you can up-vote it

2 Likes

The code from Janne on the page that @Tair_Bilyalov linked worked great for importing nearly 200 links, running 30 at a time. I didn’t try doing more than 30 since that was working and only had 200 to do.