flownative/rulebasedredirects

Implements rule-based redirects for Flow applications

v1.0.0 2022-08-09 14:35 UTC

This package is auto-updated.

Last update: 2023-01-09 15:39:45 UTC


README

MIT license Packagist Maintenance level: Friendship

Rule-Based Redirects for Flow

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.)

Installation

composer require flownative/rulebasedredirects

Usage

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