Redirects for URLs and their children

Nick 4 years ago in BLOX CMS updated by Mike Stickler 4 years ago 1
Hopefully this will be an easy answer...Is there a way to have a redirect for a url and any of its children in BLOX? For example I want thebrunswicknews.com/oldurl as well as thebrunswicknews.com/oldurl/story1, thebrunswicknews.com/oldurl/story2, thebrunswicknews.com/oldurl/this-is-just-another-page, etc to be redirected to my home page without having to make redirects for each one.

It would be even better if I don't have to create a new URL in the BLOX URL map for the redirects too, so they don't clutter the URL map.

The reason I'm asking is because Google Webmaster Tools keeps finding URLs from my old site and our BLOX site is almost a year old.
Couldn't you include script in your header along the lines of
[% if cms.url.path | contains('oldsection'); cms.system.redirect ('url': '/'); end; %]

If a file's not found the the 404 error page is going to be displayed which should use the same header includes... Only thing is I'm not sure in that case if the url.path would be the original url path or the path to the 404 page.