Redirects can be added in 2 ways. Either in a flat file (you'll need Falcon Server access for this), or, they can come from your shops API package.
To add flat redirects you must first create a
server/config/redirects.txt file. You can then add your redirects there. All redirects added to this file are treated as
This file path can be configured in your
server/config files. The config variable is
The format of this file should have each redirect on a new line with the orgin and destination seperated by a space.
In this example the url
/product-1 will 301 redirect to
We also support regex. Any entry prefixed with
@ is considered regex.
In this example any url that ends in
/product-1 will be redirected to
If you want to pass query parameters accross that is also possible by assigning them to a variable using
Each time you use the string
(.*)$ it is passed as a variable in numberical order to
$1 and then
$2 and so on.
In this example everything after
product-1 is saved as
$1 and passed to the end of the destination. e.g.
In this example everything before
product-1 is set to
$1 and everything after is set to
Redirect support is directly injected into your shops
We check for URL matches, if none are returned we then query the shops redirect API. If a match is found we return an object:
To get redirects to work you'll need to make sure you have a
DynamicRedirect component in your route
react-router-dom to handle the redirect.
DynamicRedirect should be passed to the second to last
Route component to allow the other routes to be rendered with a higher priority.
server/config/redirects.txt (for flat redirects)