Import Export URL Rewrites for Magento 2 extension allows admins to quickly import multiple URL Rewrites via a CSV file which includes all necessary data of URL rewrites. In addition, this module also supports conveniently exporting every available URL rewrites into a CSV file. Therefore, admin can save a lot of time and effort instead of doing all manually.
*Note: You can read this document from Magento to get more knowledge about URL Rewrites in the default Magento 2:
EXPLORE Magento 2 Import Export Extension Combo to break the default limit!
2. How Does It Work?
2.1. Import URL Rewrites
You go to System ⇒ Import by BSS and select URL Rewrite in the drop-down list of Entity Type.
2.1.1. In Import Behavior
- Import Behavior: There are 3 options for you to select.
+ Add/Update: This option allows administrators to add new URL rewrites to the website. In addition, it also updates URL rewrites if their request_paths already exist in the database.
If the request_path does not exist in the database, you are notified about this non-existence and the module will add a new URL rewrite.
If the request_path already exists in the database, the module will delete old URL and add a new URL rewrite.
+ Delete: This option allows administrators to remove URL rewrite according to the request_path.
- Validation Strategy: select one option from the drop-down list to determine how the system operates when there are errors in the import process.
+ Stop on Error: the system stops importing when there are errors.
+ Skip error entries: the system skips errors and continues to import.
- Allowed Errors Count: This setting allows you to choose the allowed maximum number of errors when importing. If the number of errors happening in the import process exceeds that maximum number you fill in this field, the system will stop importing.
2.1.2. CSV file preparation
Before you import URL rewrites via a CSV file, you need to prepare the CSV file with enough necessary information. You can download this CSV sample file by clicking Download Sample File. Then you open this file and fill in fields:
- Your CSV file must include enough the number of columns like the sample file so that you can successfully import it. (If the number of columns is greater or less than those in the sample file, the system will notify you about errors occurring).
- It is unnecessary to enter target_path if entity_type is product, category, or cms-page because target_path in these cases are automatically generated according to corresponding ID.
- When you enter entity_type into the CSV file:
+ if entity_type is product: enter product_ID with category_ID that includes this product or you also don’t need to enter category_ID for the product.
+ if entity_type is category: enter category_ID.
+ if entity_type is cms-page: enter cms_page_ID.
+ if entity_type is custom: no need to enter ID but you have to enter target_path to redirect.
- For current_request_path: enter the current path of the product or category or you can enter a new path if you want to add a new URL
- For new_request_path: enter the new path which replaces the current_request_path.
- For target_path: enter the internal path that is used by the system to point to the destination of the redirect
- For redirect_type: enter 0, 301 or 302. In case you enter the wrong redirect_type, it will be automatically changed into 0.
2.1.3. In File to Import
After you finish the CSV file, tab Choose File button to select the file to import.
2.1.4. Check Data and Import
After you select the CSV file, you need to click Check Data button to validate data before importing.
- If your CSV file is free from errors, there is a message to notify validation results and Import button now appears to click.
You click Import button to start importing URL rewrites in the CSV file into Magento 2 website. There is also a notification about the results of the import process.
- If your CSV file includes errors, the Import button cannot be displayed for you to click and there is a notification about these problems.
2.2. Export URL Rewrites
You go to System ⇒ Data Transfer ⇒ Export URL Rewrite. After you select Entity Type to export and click Continue button, links of the export CSV files are displayed for you to download to your computer.
2.2.1. In Export Settings
You select URL Rewrite in the drop-down list of Entity Type.
You choose CSV in the Export File Format field.
2.2.2. In Entity Attributes
In Export By section: you can export all available URL rewrites by choosing All from the drop-down list or export URL rewrites based on each attribute.
- Export by Entity Type:
When exporting by Entity Type, you need to select all or which specific Entity type to export URL rewrites.
- Export by Store View:
When exporting by Store View, you need to select all or which specific Store view to export URL rewrites of this store view.
- Export by Redirect Type:
When exporting by Redirect Type, you need to select all or which specific Redirect type to export URL rewrites.
Then click Continue button to export chosen items in a CSV file.
*NOTE: If your site includes more than 50,000 URL Rewrites, this extension will export into different CSV files and each file can contain a maximum number as 50,000 URL rewrites. Therefore, there are also many links for you to download.
3. Module updates
3.1. Version 1.0.3
If target_path does not exist, the module will display a notification message and skip that row when importing. (only apply to the entity type as custom).
3.2. Version 1.0.5
For entity_type as product, category, and cms-page: If you choose redirect_type as 301 or 302, the target path which is redirected to is URL key of a product, a category or a CMS page.
For example: We have a CSV file as below:
The link: http://domain/magento2-import-export-url-rewrites/test-new-bag-url
is redirected to:
(Before this update, this link is redirected to: http://domain/magento2-import-export-url-rewrites/catalog/product/view/id/2 – the original link of the product).
More Magento 2 Import Export extension from BSSCommerce are useful for your work: