I'm working on a redesign of a site and as part of it we've changed te URL schema, as we want to redirect all old URL to the new ones I'm struggling to get this to work
The old URL are like this
/shop/category/subcategory1/subcategory2/slug
/shop/category/subcategory3/slug
/shop/category/slug
And the new ones look like this
domain.com/new/slug
I need a regular expression to match url starting with "/shop/category" and get the last part of the url as it is the slug of the product
I can get the last part of the URL with this:
([^\/]+$)
And match the start of the URL with
^shop\/category\/
But I can't find a way to to both at the same time
Thanks!