When making changes to several gateway-level redirect rules on your WordPress site, importing them from a CSV can be incredibly useful. Not only can it be a quicker interface to make adjustments, but it also allows you to maintain your own source of truth for edits for easier collaboration.
In this article, we'll show you how to import and modify ARES redirect rules from a CSV file.
Before we get started, you'll want to download a template to base your changes from.
If you already have redirect rules in place, you can follow our instructions on exporting redirect rules to a CSV.
If you don't currently have any redirect rules in place, you can download our template to get started.
Updating Redirect Rules
Inside your preferred editor for CSV files (LibreOffice, OpenOffice, Google Sheets, Excel, etc.), open up the CSV that you want to make changes to.
The fields should look something like this:
Each column of the CSV corresponds with a value from within the GUI. Here's a quick reference for what each column does:
Tip: For more information on each column, as well as parameters and examples, click on the name to view that column's section in our Redirect Rules CSV Column Reference.
- from: A basic path to redirect from. (Example: /redirectme)
- to: A basic path to redirect to. (Example: /directory/destination)
- fromScheme: Used if the redirect rule should match a scheme. Possible values are http and https.
- fromDomain: The domain that the redirect rule should match. If empty, all domains will be matched.
- fromPath: Similar to the standard from field, but accepts additional parameters, separated by a pair of colons (::). Possible additional parameters are contains, starts-with, and ends-with. If no additional match parameter is provided, the exact path will be matched.
- fromQueries: URL query strings to match. These values are formatted like any normal query string, and can be appended by additional match parameters, similar to fromPath.
- toScheme: The scheme to redirect to. Possible values are http and https.
- toDomain: The domain to redirect to.
- toPath: The path to redirect to. (Example: /destination)
- toQueries: Defines any query strings to be added or replaced. (Example: ?new=value)
- statusCode: Sets the status code that will be sent in the server response. Possible values are 301 and 302.
- enabled: A simple true or false value to enable or disable a redirect rule.
- queryMode: The mode that is used when processing query strings. Defining update in this field will cause update and append existing query string. Defining replace-all will replace all query strings with those that you have defined, regardless of the key or value.
- description: Just a simple description to help keep track of different redirects in place.
Tip: If you're not sure about how you should configure a particular redirect inside the CSV, you can always add a similar one from within the ARES redirect GUI, then export the CSV to see the results.
Importing Your Redirect Rules CSV File
To perform the import of an updated CSV file, follow these steps:
- Begin by logging into the Atomic control panel.
- Navigate to the app list by click on Apps on the left side menu.
- Next, access the app that you want to import your redirects to by clicking on the settings icon to the right of the app's name.
- From your app's details page, click on the ARES tab to access ARES gateway rules.
- On the left side, click on Redirects to access the Redirects section.
- At the top-right, click on the Import from CSV button to open the CSV importer.
- Select your CSV by clicking on the Select CSV File button, then select how you want the file to be handled.
Your options are:
- Add new: Adds any new redirect rules, but skips any existing rules.
- Update existing/add new: Adds any new rules and updates any existing rules. Any rules that currently exist but are not found in the CSV will be left alone.
- Delete existing, then add new: Deletes all existing ARES redirect rules and replaces them with the rules present in the CSV.
- After your options are selected, click the Upload button to begin the process of importing your redirects.
- When your CSV file has finished processing, details about your import will appear. If there are any errors, they'll be displayed here.
- Finally, you'll need to deploy your changes for them to take effect. To do so, close out the import window, check over your redirect rules, and click on the Deploy Changes button.