An Easy Guide to Configure URL Rewrites in Magento 2

An Easy Guide to Configure URL Rewrites in Magento 2

An Easy Guide to Configure URL Rewrites in Magento 2

A good and friendly URL is one of the most important factors that search engines use to rank your website. According to Google, “A site’s URL structure should be as simple as possible. Consider organizing your content so that URLs are constructed logically and in a manner that is most intelligible to humans”. An URL like is more friendly and readable to both search engines and users than another one like


Therefore, to help every website to have a better URL key, a technique called URL rewrites is introduced with the purpose of rewriting bad URLs, turning them into friendly ones which are optimized for crawling of search engines’ bots and user experience.

What Are URL Rewrites?

As mentioned before, URL Rewrite is a common technique widely used by a lot of websites no matter which platform they are built. It is simply understood that URL Rewrites allows you to rewrite the original URLs generated by systems which are often complicated and bad for your ranking as well as customer experience.


Hence, URL keys can be modified to become shorter, cleaner, and make more sense than old ones.

How to Configure URL Rewrites in Magento 2 

The first thing you need to do when configuring Magento URL rewrites is enabling Web Server Apache Rewrites. The reason is that it will remove the file name “index.php” from your URLs which the system initially generates (this “index.php” is meaningless for search engines and humans).  


In the Magento 2 admin, you navigate to Stores ⇒ Configuration ⇒ General ⇒ Web.


You expand Search Engine Optimization, you set Yes for Use Web Server Rewrites field.

Settings for Use Web Server Rewrites

Then you click Save Config to complete settings.

How to Set up Automatic URL Redirects

After you enable Use Web Server Rewrites, you need to configure automatic generation for permanent redirect when there are any changes in the URL keys of products and categories. To make URLs automatically redirect, let’s follow settings as below:

Settings for automatic redirects

You go to Store ⇒ Configuration and choose Catalog section under Catalog.


Navigate to Search Engine Optimization section. 


In Create Permanent Redirect for URLs if URL Key Changed: select Yes.


Then you click Save Config to finish setting.


As you remember, in the URL key section of product edit pages or category pages, you can see a small checkbox for creating the permanent redirect for old URL.

Permanent redirect box

This is the result of enabling automatic generation for the permanent redirect. The option will help you to redirect to the new URLs when customers click the old URLs in some places where you had put links before.


Therefore, in case you want to modify the URLs of any products, let’s mark this box in order not to affect both rendering pages and user experience. For categories, you also need to tick this box to guarantee accurate redirecting.

How to Add URL Rewrites in Magento 2

Beside automatically redirect URL when they are changed, you can easily create URL rewrites for 4 types of pages: product pages, category pages, CMS pages, and Custom pages by navigating to Marketing SEO URL Rewrites.


However, you have to add each Magento URL rewrite individually, and this process is so time-consuming, especially in case you have hundreds or thousands of pages.


Therefore, there is another smart solution for store owners called import and export functions of URL rewrites which you cannot find out in the default Magento 2.


This is an extension built based on default features but includes some new things for importing and export multiple URL rewrites via a CSV file.  


You need to prepare a CSV file with all data about Magento URL rewrites, then validate it by data checking function and then import it into Magento 2 website with one click.


As a result, you can rewrite a lot of URLs for page types at one time without taking much time to carry out as before.

Prepare URL Rewrites data in a CSV file

Moreover, if you want to get available URL rewrites on the website to move them into another one, you can export them very easily into a CSV file also.

Export all URL rewrites

DOWNLOAD Magento 2 Import Export URL Rewrites to save your time and get higher efficiency

*Note: If you already enabled automatic redirects on your website, there is no need to create  Magento URL rewrites for products, category pages.


However, if going to so many pages to edit and mark the box is also a big problem for you, let’s take consideration about Magento 2 Import/Export URL Rewrites – Do one CSV file but save many efforts!


You can also take a look at these following blog posts to get more understanding about Magento 2 Import Export extensions:


eCommerce Lead Marketer at | Posts

I am quite passionate about Ecommerce and Technology, love sharing helpful information about Marketing, SEO, and business management for global readers. I feel like traveling to new destinations for the cultural experience and beautiful sightseeings.

Write A Comment