A redirect simply redirects a browser to another page of a site.
Redirects are often used for:
Use Regex | If checked, the redirect lookup will check the URL against the given regex pattern. If there's a match, the redirect will occur. See More About Regular Expressions below. |
Origin | The URL you want directed elsewhere. This must be in the form: //DOMAIN/PATH Both the domain and path values are required. If Use Regex is checked then the path should contain a regular expression pattern. |
Destination | Where you want the visitor to end up. This can be a custom URL, a page, a document, or an image. |
Is Permanent | Checking this will instruct browsers to cache the redirect result and skip contacting the web server. We recommend that you test a redirect before you check Is Permanent. Once the redirect works as expected, then check Is Permanent and republish. |
Notes | Used for keeping internal notes about redirects. |
Regular expressions in Marketpath CMS utilize .Net Regular Expressions. The goal is to capture patterns of characters and redirect the user to an alternate page or a different website altogether. Regular expressions can be used for the domain or the path or both. The example Origin below will redirect all domains for a given site that have a path starting with "how-to".
//[^/]*/how-to/.*
This might be useful if you move all pages to a new URL structure.
You can also take advantage of regular expression groups, capture the results, and use those results in your Destination. Let's take the example above and add groupings:
//([^/]*)/how-to/(.*)
This regex pattern captures two groups - the domain, "([^/]*)", and the path after /how-to/, "(.*)". We can setup our Destination to include the captured values from those two groups:
https://somecustomapp.com/dosomething?domain=$1&page=$2
$1 refers to the first captured group (the domain) and $2 refers to the second captured group (the path after /how-to/).