Redirect from multiple folder to single folder url

I’m trying to redirect my old blog page to new webflow url. Old blog url contains multiple level folder structure.
For eg. /category/sub-category/**blog-slug**/blog/**blog-slug**

I tried using /category/sub%-category/(.*)/blog/%1 and /category/(.*)/(.*)/blog/%2
Final redirect after applying those rules is /blog/sub-category/**blog-slug** instead of /blog/**blog-slug**

Hi Prakash, it looks like you’re trying to treat the redirects table as a rules sequence, but there is no ordering and only one ( or zero ) will match.

You’re describing your URL structure as /category/sub-category/blog-slug, so my guess is that an example might be /coffee/de-caf/nespresso-is-great.

In that case your redirect would probably be;

/(.*)/(.*)/(.*)/blog/%3

Which might present problems because it would match any 3-level hierarchy. You might be safe if your blog paths are the only ones with this depth.

It looks like you’ve followed this: 301 redirects | Webflow University

It looks like one of your examples has the correct “capture groups”.

What exactly is not working?

Thanks, this rule worked /(.*)/(.*)/(.*)/blog/%3 and the site contains only blogs
And i tried /(.*)/(.*)/blog/%2 to capture 2 level hierarchy but throw an error

A redirect from /(.)/(.) to /blog/%2 creates a redirect loop.

Yep that wouldn’t work, because /blog/xxx also matches /(.*)/(.*).
You MIGHT be able to sort of hack by adding a dummy querystring to the end, e.g.

/(.*)/(.*)/blog/%2?x

In my tests, querystrings require separate explicit matching patterns in Webflow, so that shouldn’t create a loop.