This package uses a PSR middleware to redirect requests to URLs using regular expression based rules.
It can be used to implement such redirect rules in cases where you cannot use the native ways of implementing them in your webserver (e.g. nginx or Apache httpd.)
composer require flownative/rulebasedredirects
As soon as the package is installed, the rules given in Flownative.RuleBasedRedirects.rules
take effect. Here is an example:
Flownative:
RuleBasedRedirects:
rules: []
- host: '/^www\.acme\.com$/'
path: '/^\/foo\/(.*)$/'
target: 'https://www.acme.com/elsewhere/$1'
status: 301