Redirects are a way of setting up rules to have pages redirect automatically for your visitors. These are great tools to use if you adjusted the pages names on your site and need former links to redirect to the new ones.
Note: If you are in the process of migrating your account and you are not using redirects, you can move on to the next section of the migration process.
Skip right to importing redirects in bulk.
About redirects with WP Engine:
At WP Engine we use a server setup that utilizes the Nginx platform as well as Apache. What this means is that you’ll want to setup all of your redirects in your User Portal instead of other ways such as using the .htaccess file or using plugins (because these are handled on the Apache level).
This article covers setting up redirects with 3 steps:
- Access the Redirects section from your User Portal.
- Input your paths in the Redirect Rules tool.
- Submitting a redirect list.
These steps are explained in more detail below.
1. Access the Redirect Rules section in your User Portal
First, log into your User Portal and navigate to the environment to which you want to add a redirect. Once in the Overview screen, click the Redirect Rules option in the left-hand navigation.
2. Input Your Redirect Paths
Now you’ll be at the Redirect Rules page where you can create and configure your various redirects. The most common redirect is to simply have one page redirect to another. To set this up, first click the New Redirect Rule button.
In this example, we’ll be showing you how to redirect a single page. We are going to make janna.wpengine.com/info/ redirect to janna.wpengine.com/accounts/
First, you have the option of giving your redirect a Name to make it is easier to identify (this is just a label and doesn’t affect the redirect).
In the Domain field, you can select if you would like this redirect to affect a single domain or all of your domains (if you have more than one).
In the Source field, you’ll be entering the original path that you want to redirect from. The source requires a slight bit of regular expression syntax which works like this:
First start with the ^ symbol, this is a way of saying “starting from this point”. Then type in your source path and end with /?$ which basically indicates the end of the path to match. Our example source path is janna.wpengine.com/info/ so we’ll enter this into the Source field:
Next, we’ll enter the Destination field which is where we want the visitor to be redirected to. This section simply requires you to enter your path starting with a forward slash. Our example destination is janna.wpengine.com/accounts/ so we’ll enter this full URL (including http!) into the Destination field:
Once you have your new redirect configured, just click the Save button to save your new redirect. In the next section, you will have the opportunity to preview your site and test your new redirects.
3. Submitting a List of Redirects
When creating redirects and rewrites for your WP Engine site, there may be sites you work on which have a large number of redirect rules that need to be imported. Our User Portal supports up to about 1000 redirects to be imported. After about 1000 redirect rules, we’ve seen performance issues, so we strongly recommend keeping this list under that amount. Our Support Team can help import these redirect rules for you! Before continuing though, we recommend taking the following steps:
- Perform an audit of the redirect rules. See if any are no longer needed, or if any of them follow the same pattern and can be grouped into “rewrites”, where requests matching a specific pattern are redirected based on that pattern.
- Ensure the rules are in a text document (something easy to copy/paste from), and formatted like .htaccess redirect rules.*
Once you have taken this step to help curate your list of redirect rules, please contact our Support team via your User Portal, under the option for “Support 24/7” in the top navigation. Provide Support with the list of redirect rules, and they can assist in bulk-importing these for you!
If these rules are already in your site’s .htaccess file from a previous host, feel free to copy the rules and paste them into a .txt file for our Support team to import for you.
Redirect “domain.com/path/match/” to “domain.com/something/”
Alternative format: Redirect “domain.com/path/match/” to “domain.com/something/”
Redirect 301 /path/match/?$ http://domain.com/something/
Redirect “domain.com/path/more/anything” to “domain.com/anything”
RewriteRule /path/more/(.*) http://domain.com/$1 [R=301,L]
Redirect a domain with an argument (?example-arg=123) on the end: “domain.com/path/match/?example-arg=123” to “domain.com/something/”
Redirect 301 /path/match/?example-arg=123 http://domain.com/something/
We won’t be able to import more than 1000 redirects so we suggest reviewing rules to match for patterns instead of individual pages.
We use what is called Regular Expressions (also known as Regex) in the Source section of our redirects. Regular Expressions are very useful because they allow you to specifically create more advanced search strings which can be very beneficial for configuring advanced redirects. If you would like to learn more about how they work, please see our Common Regex Used For Redirect Rules article.
Good job, now that your redirects are setup you can move on to the next step!