I have a redirect that we tested in another thread that works perfectly to route urls from mydomain.com/aa-aa to mydomain.com/primary-category/29-aa-aa (where 29 is the article ID and aa-aa is the article alias.
I am now adding subcategories. So the new url has an extra category id and category name:
mydomain.com/primary-category/141-subcategory/29-aa-aa (where 141 is the subcategory ID and 29 is the category ID)
Here is the original redirect that works when there are no subcategories:
From URL: ^/[0-9A-Za-z\-]{5}$
To URL: {scheme}://{siteurl}/${category}/${id}-${alias}
Skip: /login$
Redirect: 200
Request Only: True
Placeholders: I'll attach photo because the forum won't allow database code.
How can I tweak the to URL so that it will go to an article whether it is in the primary category or subcategory.
By the way, all of the article alias's are unique (i.e., aa-aa is the only article with that alias), so perhaps there is a macro that can fill everything in between.