You can use the Redirect plugin to redirect simple routes but also use it for more advanced route matches.
These are used for simple A -> B redirects. You may use absolute URLs or relative URLs in either the source or the destination.
Dynamic routes are routes built using regular expressions. As such, you must be
very careful when you create them. Know your escape characters (such as /
) as
they are required in the source URL but not the destination URL.
Create matching groups in your RegEx and reference them in the destionation the
same way you would in preg_replace
: $1, $2, ..., $7, etc
See some examples below.
Source URL:
oldpage/wont/work/anymore
Destination URL:
newpage/will/work/again
Source URL:
oldpage/wont/work/anymore
Destination URL:
https://www.newwebsite.com/newpage/will/work/again
Source URL:
^category\/(.+)\/overview.php$
Destination URL:
overview/category/$1/index.html
Source URL:
^cars\/(.+)\/(.+)/(.+)\/index.html$
Destination URL:
overview/cars/$1/colors/$3
Source URL:
^some-deprecated-page\/*
Destination URL:
my-new-page