How to bulk-import or export redirection rules?
Importing redirection rules is a productive way to add many redirection rules at once. redirection.io supports importing
The import screen can be accessed from the "Rules" screen:
- head to the dashboard of your project
- hit the "Rules" menu link
- Click the "Import" button, on the upper right corner of the page
- Select a CSV file containing the redirections that you want to setup. The import tool helps defining the role of each column, so the columns order is not important.
- in the "File format and columns", you can configure the CSV file format, ignore the first line, and choose for each column of the CSV file the type of data that it contains.
- the Markers step allows to define the properties of markers strings that have been included in the file. Each occurrence of a marker string will be replaced with a redirection.io marker
- At the "Execute import" step, you can choose to ignore errors in the imported file. If this switch is checked, the import tool will do its best to import all the rules it is possible and safe to create, and it will ignore errors or warnings. If the switch is not checked, the import will be more strict and completely fail even if there is only one error.
- Once started, the import duration depends on the number of rules to import - it usually takes some seconds, but can take several minutes if there are tens of thousands of rules. Should there be mistakes in the import file, the import tool will allow to download a CSV file containing the errored lines, so that you can fix them and try again to import the redirections file.
Format of the import file¶
The import tool of redirection.io is rather flexible and permissive. Here are some tips to know.
The columns order is not important¶
The only requirements on imported files is the file format, which must be a valid CSV file.
Once you have selected the file to import, the import tool displays the 100 first lines of the file. It allows to ignore the first line (if it is a header line) and define the role of each column. The column roles that can be mapped are: Source URL, Target URL, Status Code, Rank of the rule. These columns can appear in any order in the CSV file.
Imported files limits¶
The limit of the size of imported files is quite high, and mainly depends on the size of the URLs defined in the file. You should be able to import several hundred of thousands of rules with a single file. If it does not work, please split the import in several smaller files.
Imports can also define 404 and 410 actions¶
The import tool has been designed to help importing large redirection collections, but it can also be used to create rules with HTTP 404 - Not found or HTTP 410 - Gone actions. Simply add a "Status code" column in the CSV file:
Source URL;Target URL;Status Code /some-source;/some-target;302 /this-is-not-found;;404 /this-is-gone;;410
Importing very large rulesets¶
The import tool has been designed to import very large redirection files. The number of rules that can be created with one single import depend on the size of each URL, but you can expect to be able to load ~500k redirection rules with one single import, and it should take about 10 minutes to complete.
When importing large redirection files, we advise to check the switch "Ignore import errors". If there are some errors in the file, you will be able to download a CSV file at the end of the import, containing only the lines with errors. Once fixed, you may re-import this file to have your redirection plan completed in the shortest possible time.
Logs and rules exports¶
redirection.io allows to export logs or rules as CSV files. In the list of logs or in the list of rules, choose the columns to display, use the filters of your choice, and simply hit the "Export" icon, on the top right of the list. It will trigger the download of a CSV file containing the chosen columns, using the right filters.