I am using a Drupal site on top of nginx, and would like to be able to redirect a set of pages from an old style url, to a new one, using 301s. The content has already been migrated over to the new urls, but there may be links elsewhere with the old style. How can I achieve 301 redirects for matching paths, to redirect using part of the information from the old url to inject into the new one (namely [timestamp]).
From:
example.org/article/[timestamp]
To:
example.org/article/doi/static-[timestamp]
I know how I would do this with .htaccess, but is there a way to do this in Drupal itself, or a module to achieve this?
Having looked at the docs, I think that
drupal_goto($path = '', array $options = array(), $http_response_code = 301)
May be the best way to go, with a corresponding (pseudocode):
if path == oldpath,
drupal_goto(etc.)