Redirect to same URL but different parent page

I’m trying to relocate all the children of the page ‘blog’ to a new page ‘articles’.

I would like to redirect anyone who uses the deprecated ‘blog’ urls, e.g.:

/blog/page redirects to /articles/page

Question is: How do I do this? I can create a route as follows, but I’m unsure how to preserve the url in the redirect, i.e.:

    [
      'pattern' => ['blog/(:any)'],
      'action'  => function() {
        go('articles/**[HOW DO I PRESERVE THE REST OF THE URL HERE?]**');
      }
    ]

Help much appreciated!

You pass the placeholder from the pattern as argument to the callback.

  [
      'pattern' => 'blog/(:any)',
      'action'  => function($slug) {
        go('articles/' . $slug);
      }
    ]

Ideally, this type of redirect would be done in .htaccess though, because server-side rewrites kick in earlier.