Skip to content
Snippets Groups Projects
user avatar
Lara van Zuilen authored
7de6e01c
History
user avatar 7de6e01c

#Regex Redirect

##CONTENTS OF THIS FILE

  • Description
  • Requirements
  • Installation
  • Configuration and use
  • Todo's

DESCRIPTION

The Regex Redirect module is a path management module for Drupal 8 and Drupal 9. It is an extension of the redirection API provided by the redirect module.

The primary use case for this module is to:

  • Create redirects which will redirect all URLs matching a specific pattern
  • View existing regex redirects in an admin view

The module itself may be found at regex_redirect Please report bugs in the issue queue.

REQUIREMENTS

This module requires the redirect module.

INSTALLATION

The module is installed is the regular manner.

CONFIGURATION AND USE

1. Enable to module at Administration > Extend
2. View the regex redirects at Administration > Configuration >
   Search and Metadata > Regex redirects
3. Create regex redirects by clicking "Add regex redirect". Set a title
   to recognize the redirect pattern by. The redirect source field should
   be a regular expression with named captures. The redirect path should
   contain the named capture variables. Also select the redirect status and
   language.

Examples:

Source Target
node\/(?P<id>[0-9\.]+) /news/<id>
page\/(?P<id>[0-9\.]+)\/(?P<month>[a-z\-]+) /event/<id>/date/<month>

TODO'S

  • Add a unit test for the RegexRedirectRequestSubscriber
  • Create kernel tests for RegexRedirect
  • Create WebTestBase tests for RegexRedirectForm
  • Update Repository test to use KernelTestBase (for checking access)