How to Import and Export URL Rewrites in Magento 2

Magento 2 URL Rewrites Import and Export

This article discusses a significant point of every migration between e-commerce stores. Below, we describe how to import and export URL rewrites in Magento 2. Unfortunately, your e-commerce storefront doesn’t let you perform this data exchange by default. The import and export capabilities of Magento 2 are fairly limited and lack support for numerous entities, including URL rewrites. However, you can address the existing data sync problems with the help of third-party services, such as the Improved Import & Export Magento 2 extension. In the blog post below, you will learn how to use the extension to import and export URL rewrites between Magento 2 websites or from beyond the ecosystem. At the same time, we shed light on the URL Rewrites Magento 2 sample import and export table, explaining its attributes. You will also find a detailed description of the Improved Import & Export solution since it delivers lots of opportunities, in addition, to support for URL rewrites. 

Even medium e-commerce websites could have hundreds or thousands of URL rewrites. Consequently, you need a plethora of time to recreate them on a new site or edit for the existing one. Unfortunately, Magento 2 offers no tools that simplify this process. But the platform would never be so cool without its ecosystem of third-party extensions, so meet the Improved Import & Export Magento 2 extension – your number one tool for running import and export processes.

The module enables the missing ability to import and export URL rewrites to/from Magento 2. Besides, it adds dozens of other vital features the platform lacks by default, but let’s take a look, and the URL rewrites import/export functionality first.

Table of contents

URL Rewrites Magento 2 sample import and export table and attributes explained

The url rewrites import and export files come with the following set of attributes that represent the rewrite settings. You can get the sample files for import and export with every attribute value set from:

Attribute name Reference Values Value example
url_rewrite_id ID of the URL rewrite. Can be found under Marketing>URL rewrites, in the ID column. Use this if you want to update a particular rewrite. Can only contain numerals 321
entity_type Create URL Rewrite setting of the URL rewrite. Defines the type of entity for URL rewrite. Required attribute.

Available values:

category – For Category

product – For Product

cms-page – For CMS Page

custom – For Custom

category
entity_id ID of the entity of the URL rewrite. For example, if you are creating an URL rewrite for a particular product  – you need to specify the ID of this very product. Can only contain numerals 123
request_path Request Path of the URL rewrite. The path the visitor needs to hit in order to get redirected. Required attribute.

The paths are specified in reference with the store name. Does not contain full store name.

For example:

store.com/path1

Should look like

/path1

/about
target_path Target Path of the URL rewrite. The path the visitor will be redirected to, when proceeded by request_path. Required attribute.

The paths are specified in reference with the store name. Does not contain full store name.

For example:

store.com/path1

Should look like

/path1

/about-us
redirect_type Redirect Type of the URL rewrite. Defines the type of the redirect for of the URL rewrite for search engines. Required attribute.

0 – No type

302 – Temporary (302)

301 – Permanent (301)

302
store_id Store of the URL rewrite. Needs to be ID of the store view where the URL rewrite is applicable. Required attribute.

Store View Code can be found under: Stores > All Stores > next, click required store view and check “Code” column.

1
description Description of the URL rewrite used for identification purposes Can be any value Test category redirect
is_autogenerated Defines if the URL rewrite has been automatically generated by Magento 2 or manually created. 0 – manually created

1 – automatically generated

0
metadata Optional attribute Apply value only if you know what you are doing {“category_id”:”47″}

NOTE pay attention to how request_path and target_path contain only the path after the store URL. For example:

store.com/path1

Should look like:

/path1

Magento 2 URL Rewrites Import

By installing the Improved Import & Export Magento 2 extension, you enable the following features related to the Magento 2 URL rewrites import functionality:

  • Import all URL redirect types:
    • No,
    • Temporary (302 redirects),
    • Permanent (301 redirects);
  • URL rewrites update with new target paths;
  • URL rewrites bulk delete.

Magento 2 URL Rewrites Export

At the same time, the Improved Import & Export Magento 2 extension offers the following features related to the Magento 2 URL rewrites export functionality:

  • Export all URL redirect types:
    • No,
    • Temporary (302 redirects),
    • Permanent (301 redirects);
  • Export URL rewrites data on the selection of all kinds or a custom type and a system type separately;
  • Export URL rewrites with Product SKU vs. Product ID – the feature radically simplifies transfers between installations with the same products but mismatched product IDs;
  • Export custom added 301 permanent redirects.

Get Improved Import & Export Magento 2 Extension

Other Features

The Improved Import & Export Magento 2 extension offers lots of other features related to the import/export possibilities regarding URL rewrites. First of all, it is necessary to mention that you can run all operations on the basis of a store view or website.

Next, we’d like to draw your attention to the fact that it is possible to do all the operations right within the Magento 2 backend. You don’t need to have coding experience or advanced Magento skills to run import/export processes. Just open a corresponding section of the module (import or export), create a new profile, and specify transfer parameters. And you can fully automate every URL rewrites import and export!

Schedules

The Improved Import & Export Magento 2 extension offers a very flexible system of scheduled jobs that allows you to switch data transfers to autopilot. The module supports cron so that you can create any update period. Use the default cron syntax to specify a schedule that suits your particular business needs.

In addition to custom intervals, the Improved Import & Export extension offers a list of the predefined values. You can select one and apply any changes to it with the help of the syntax mentioned above.

Besides, it is possible to avoid schedules and create a profile that can be launched in a manual mode only. You can run it for non-periodical updates reducing the resource consumption caused by empty import/export processes.

Note that asynchronous run is enabled for scheduled profiles as well. This feature is especially useful when the data is provided before schedule, but it is an urgent update that cannot be delayed for the planned date. The Improved Import & Export Magento 2 extension lets you run any profile whenever you need.

Below, you can see how to configure a schedule:

Extended Connectivity

Another essential moment we’d like to describe here is the extended connectivity options of the Improved Import & Export Magento 2 extension. While Magento works with CSV files only and most third party extensions that enable URL rewrites transfers don’t extend the existing boundaries, our module does a great job in this area.

File Formats

In addition to the standard CSV format, the extension supports multiple other standards reducing the necessity to convert data files. First of all, the Improved Import & Export Magento 2 module works with XML files. It is a prevalent standard used by multiple external platforms to run data transfers. Besides, our plugin works with JSON, ODS, and Excel files.

File Sources

As you can see, the selection of formats is huge so is the variety of file sources. You can select one of the multiple points of connection between your e-commerce store and an external system while transferring URL rewrites data.

The Improved Import & Export Magento 2 module offers an excellent opportunity to leverage your local server for the purpose mentioned above. At the same time, you can streamline a remote server to move data files to/from your website. Both file sources are available with the module due to the extended FTP/SFTP support.

The alternative solution is represented by popular cloud storage. The Improved Import & Export Magento 2 extension is integrated with Dropbox so that you can use your account in the cloud to move tables with URL rewrites to/from your store.

The third way to run the transfer is related to import processes only. Our plugin allows you to move URL rewrites data to Magento 2 right via a direct URL. Also, note that the Improved Import & Export Magento 2 extension extracts all compressed files automatically.

Alternative Ways of Import/Export

If file transfers don’t satisfy your business goals, our module offers several more ways to import/export URL rewrites to/from Magento 2. First of all, you can transfer any data from Google Sheets. The corresponding procedure looks as follows:

Magento 2 Google Sheet import

At the same time, the Improved Import & Export Magento 2 extension offers the ability to establish a two-way connection between your e-commerce store and any third-party platform via SOAP API, REST API, and GraphQL API. Note that the extension features an entirely suitable for all file formats, sources, alternative ways of import/export, and entities.

Rich Mapping Opportunities

Mapping functionality is another crucial aspect of the Improved Import & Export extension. The module offers lots of improvements in this area providing numerous features that save your time and effort and eliminate manual data editing. Let’s take a look at each function individually.

Attributes Mapping

Since different platforms implement different attribute standards, you cannot take the output from an external system and move it directly to your e-commerce store. Therefore, you always have to match external attributes to ones used in Magento 2. The traditional approach requires editing data files manually which is a dull routine. Luckily, the Improved Import & Export extension is designed to eliminate it completely.

The plugin lets you use a mapping interface to match external attributes to ones used in Magento 2, becoming a number one time-saver for all data transfers. You can make any external output suitable for the Magento 2 import within just a few clicks by applying presets for the import tables. Mapping presets are pre-made mapping schemes created by our specialists. There is no need to match attributes on your own if you use them. Merely select a platform which provides the import file in the import profile section and apply the corresponding mapping preset. Let’s take a look at how to import URL rewrites from Magento 1 to Magento 2 with the help of the procedure we’ve just described:

Go to the ‘Select a Platform’ field, choose a preset for mapping Magento 1 attributes to ones used in 2.x, and click the ‘Load Map Attributes’ button. You can also view sample files which are available below the presets drop-down.

Now, let’s tell a few more words about how everything works. As you can see, the Improved Import & Export extension maps attributes automatically. It compares system attributes of Magento 2 with ones specified in the import file. Next, the module maps the fields of the table which are not suitable for system requirements to the corresponding system values. As a result, you get a grid with matched attributes:

Please, contact our support regarding mapping presets for your specific business case. Leave your requests here: Firebear Help Center.

Note that you can complete the same procedure manually in the same import or export profile in the admin section of your store. Open the mapping section and add a new mapping row. Go to the ‘System Attribute’ column and select a default Magento 2 attribute there. Next, specify a corresponding import attribute in the ‘Import Attribute’ column.

Note that there is the third column where you can apply hardcoded or default values which are specified for each imported item in the corresponding column automatically. Thus, it is possible to define the same store view for all elements in the table by adding the corresponding value to the appropriate attribute in the “Default Value” column.

Also, note that all mapping schemes are saved and stored within the Improved Import & Export extension. The module automatically applies them for further updates. The mapping procedure becomes a one-time process, which is not possible in case of the default Magento tools or most third-party extensions. You either need to map everything manually or repeat mapping before every update.

Attribute Values Mapping

The Improved Import & Export Magento 2 extension allows you to map not only attributes but also their values. Thus, you no longer have to edit them manually to make suitable for the specific e-commerce requirements or import unsuitable ones. With our module, you can quickly match external attribute values to the corresponding values used within your website. You can find the necessary tools in the mapping section described above. To achieve the goal, select an external attribute, map it to the internal one, and match their values.

The following example shows how you can use the attribute values mapping functionality introduced in the Improved Import & Export Magento 2 extension. Let’s assume that you have an update file that contains product data with the “color” attribute which has several values: “deep-blue” and “ultramarine-blue” for instance.

Now, let’s take a look at your database. There is only one value that matches the ones above – “blue.” Use the Improved Import & Export Magento 2 extension to map both external values to the one used inside your store. Thus, you will import products with the new color value: just “blue” for both instead of “deep-blue” and “ultramarine-blue.”

Attribute Values Editing

The previous feature has an equivalent that helps you act in a slightly different manner when it comes to attribute values. With the Improved Import & Export Magento 2 extension, it is possible to edit multiple values in bulk using various rules. Combine the following rules to implement more precise edits.

  • Adding prefix to attributes. For instance, you have “color” is an attribute that you need to modify. It is necessary to replace the “green” value with “lime-green.” If your database includes multiple products with labeled with the first value, you may spend weeks replacing the initial color with the new one. Instead, you can add the “lime-” prefix to the existing value automatically.
  • Adding suffix to attributes. The opposite action is possible as well. If necessary, you can combine them creating a more powerful rule.
  • Split data stored in one block. The Improved Import & Export Magento 2 extension provides the ability to split data stored in one block to multiple blocks.
  • Merge data from various blocks. The opposite rule can be created as well, so if you need to combine data from multiple blocks, it is not a problem at all.

The Improved Import & Export Magento 2 extension provides the ability to use RegEx to edit values stored right in the source file. For further information, read this article: How to Modify Attribute Values During Import and Export in Magento 2.

Attributes On The Fly

Another feature related to attributes is the ability to create them on the fly. With the Improved Import & Export Magento 2 module, you are always saved from issues caused by the lack of attributes in the import file. The module lets you replace the attribute name with the data necessary to create a missing attribute. Use this general format to generate attributes on the fly during import:

Use a pipe symbol to separate values and start each attribute column with ‘attribute’. The full scheme for creating attributes on the fly looks as follows:

You can find more information about attributes on the fly creation here: Product attributes import.

Category Mapping

The last mapping feature we’d like to describe in this article is the category mapping. The Improved Import & Export Magento 2 extension lets you save lots of time by matching external categories to the existing ones or creating something utterly new right during the import process.

To enable the appropriate functionality, visit the Map Categories section of your import profile. Here, you can load values from the ‘categories’ column which is available in your import table. Clicking the ‘Load Categories From Import File’ button. Next, hit the ‘Add New’ button. In the newly displayed grid, find the ‘Import category path’ column and choose an external category from the import file. Now, you can match it to an appropriate Magento 2 category using the ‘New category path’ column:

Note that you can create new categories to run products import to them right from the profile page. Click the ‘New Category’ button to proceed to the corresponding section. On a new screen, you can specify a name of your new category as well as select its parent category just like shown below:

The following video illustrates more features of the Improved Import & Export Magento 2 extension:

[embedded content]

Conclusion

As you can see, automated import and export processes are a piece of cake if you use the Improved Import & Export Magento 2 extension and URL rewrites transfers are not an exception. If you still any questions regarding the functionality of our module, follow the link below and contact our support:

Get Improved Import & Export Magento 2 Extension

URL Rewrites FAQ

What is meant by URL rewriting?

URL rewriting is associated with changing a URL to the required format. Consequently, existing URLs become more search engine friendly and easier for humans to read. Usually, it works as follows: When the URL is entered into the Web server, the URL rewrite engine enters the game. It modifies the syntax behind the scenes to enable the appropriate Web page or database item to be retrieved.

What is the use of URL rewrite?

You can rely on the URL Rewrite instruments to perform URL manipulation tasks. For instance, it is possible to define powerful rules to transform complex URLs into simple and consistent addresses, producing user and search engine-friendly results.

What are URL rewrites in Magento 2?

The URL Rewrite tool is one of the most awesome SEO instruments available in Magento 2 by default. It empowers you with the ability to edit any URL linking to a product, category, or CMS page. Furthermore, enabling the rewrite redirects visitors who access the old link to the new address.

How do I change the URL rewrite in Magento 2?

You can change URL rewrites in Magento 2 under Admin -> Marketing -> SEO & Search -> URL Rewrites. Press the Add URL Rewrite button and select “Custom” in the Create URL Rewrite select box. After that, you need to decide for which store view you apply the changes. Next, specify the redirection path in the Request Path field.

How do I change the target path in Magento 2?

You can change CMS Page’s target path under Content -> Pages:
– Choose a page you want to work with and click Edit.
– Expand the Search Engine Optimization drop-down.
– Update the Magento URL Key.
– Save the changes.

How do I get a product URL?

You can get a product URL under Admin -> Marketing -> SEO & Search -> URL Rewrites. Press the Add URL Rewrites button in the upper-right corner. You will see the dropdown list of Create URL Rewrites. Select the “For Product” option here. The product list displays. Hit the product that you want to apply changes to.

How is the user-friendly URL of a product or category defined?

Since the URL key is part of a static URL that describes a product or category page, you have to make it friendly for users and search engine bots. It is recommended to add the product name and keywords to URL keys to improve the way they are indexed by search engines. Also, note that it is possible to configure a URL key to create an automatic redirect if it changes.

How to import and export URL rewrites via API?

With the Improved Import & Export extension, you can create an API connection between your Magento 2 website and any external platform to transfer URL rewrites.

How to import and export URL rewrites automatically?

Since the Improved Import & Export extension incorporates cron, you can leverage the module to create a schedule of import and export processes. Consequently, you can create a connection and update the data regularly within the specified time frames.

How to import URL rewrites from Google Sheets?

If your URL rewrites are stored in Google Sheets, it is no longer an issue. The Improved Import & Export Magento 2 extension lets you transfer them directly from this platform.

Discover more from WHO WILL CARE eCommerce

Subscribe now to keep reading and get access to the full archive.

Continue reading