Mutliple rewrites/redirects in settings.php on a Pantheon hosted site We are in the process of migrating a Drupal site to Pantheon. The site uses about 55 rewrites and redirects rules in its pre-migration NGINX configuration. Most of them (32) include widlcards (eg. ^/something/(.*) redirects to /something-else/) and an handful even keep the matching substring into the redirect-to URL (eg. ^/another/one/(.*)$ redirects to /something/else/$1).

Pantheon does not support redirects at the web-server levels and suggests doing redirects in the settings.php (to avoid boostraping Drupal). But 55 redirects seems enough to start worry about maintainability of a bunch of if blocks. There is also the performance cost of 32 pattern matching for each request. So a little care has to be taken to avoid maintenance nightmare in the future.

I'm not too worried about performances since the site is mostly cached anonymous traffic. But in addition to requiring a full bootstrap, the Redirect module (already used on the site) is not an option as it does not support wildcards.

I'm toying with the idea of crafting something with nikic/FastRoute to be used from settings.php. But this seems a bit overkill for 55 redirects.

I'm curious what options have been used on other sites with similar requirements.
If you have a reverse proxy service/server sitting in front of your Pantheon instance, it seems like that's the place to place your redirect rules. Rewriting/redirection is a common feature of reverse proxies.

For example, CloudFlare supports redirect patterns under its Page Rules manager. Pantheon has a few doc pages that bring up using CloudFlare so it looks to be a common configure they see used with their service.

If you have a Varnish instance in front your Pantheon instance, you can configure rewrite/redirects in VCL.