Safe Redirect Manager Plugin
UAMS websites should use the Safe Redirect Manager to manage the redirects.
Creating a Redirect
In the back end, go to Tools, then go to Safe Redirect Manager. Click “Create Redirect Rule” near the top of the page.
Make Sure You’re In the Correct Site/Subsite
Redirects must be made in the site/subsite for the URL being redirected.
If this is for a site/subsite within a subdirectory multisite, make sure you are going to the back end of the relevant site.
A subdirectory multisite uses folders rather than subdomains
We typically refer to the root site (or main site) of a subdirectory multisite as the “site.” We then refer to all other sites within that subdirectory multisite as “subsites.”
An example of the site on a subdirectory multisite is the main College of Medicine site within the College of Medicine site as a whole. Its homepage URL is https://medicine.uams.edu
.
An example of a subsite on a subdirectory multisite is the Department of Anesthesiology site within the College of Medicine website. Its homepage URL is https://medicine.uams.edu/anesthesiology/
.
The Fields
“Redirect From”
This should be a path relative to the root of your specific WordPress site/subsite. If this is for a site within a subdirectory multisite, this should be relative to the root of that subdirectory.
In the example of the Department of Anesthesiology, the root of the subdirectory would mean the /anesthesiology/
part of the URL. Any path relative to the root of that site would start after /anesthesiology/
, but would start with a forward slash (/
).
If we were redirecting https://medicine.uams.edu/anesthesiology/about-us/
, the path relative to the root of the Department of Anesthesiology would be /about-us/
.
Regular Expressions
Clicking the “Enable Regex” checkbox allows you to use regular expressions in your path. There are many great tutorials online about regular expressions.
Wildcards
You can also use wildcards in your “Redirect From” paths. By adding an *
at the end of a URL, your redirect will match any request that starts with your “Redirect From.” Wildcards support replacements. This means if you have a wildcard in your from path that matches a string, you can have that string replace a wildcard character in your “Redirect To” path. For example, if your “Redirect From” is /test/*
, your “Redirect To” is http://google.com/*
, and the requested path is /test/string
, the user would be redirect to http://google.com/string
.
“Redirect To”
This should be a path (i.e. /test/
) relative to the root of the entire site or a URL (i.e. http://example.com/wp/test/
). If a requested path matches “Redirect From,” they will be redirected here.
In the example of the Department of Anesthesiology, your “Redirect To” path should be relative to the root site, which is https://medicine.uams.edu/
. If we were redirecting traffic to https://medicine.uams.edu/anesthesiology/about/
, the path relative to the to root of the entire site would be /anesthesiology/about/
.
“Redirect To” supports wildcard and regular expression replacements.
If you used a wildcard (*
) in “Redirect From”, you can add *
to your “Redirect To” value to pass the matched string from “Redirect From” to the final URL.
“HTTP Status Code”
HTTP status codes are numbers that contain information about a request (i.e. whether it was successful, unauthorized, not found, etc). You should almost always use 301 (permanently moved)
.
“Order”
The “Order” field accepts a numeric value which determines the order of operations for matching the requested path to a “Redirect From” value.
It is a good practice to set this to 30
for most page-specific redirects. This way, you can add more specific redirects later that use lower “Order” values.
If you are redirecting entire folders (using regular expressions or wildcards), you should use 50
for the first folder level in the “Redirect From” field (i.e. /foo/*
), 49
for the second folder level (i.e. /foo/bar/*
), and so on.