An Easy Guide to Configure URL Rewrites in Magento 2

[Updates] An Easy Guide To Configure Magento 2 URL Rewrites

by Van Nguyen

A good and friendly URL is among the crucial factors that search engines consider 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 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.

Let’s explore how to perfect Magento 2 URL Rewrites!

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 on. In other words, URL Rewrites allow 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.

Benefits of URL Rewrites in Magento 2

Magento 2 URL Rewrites enable store owners to inject high-value keywords that help search engines index products more effectively. 

Plus, the URL Rewrite tool in Magento 2 helps create additional URLs for temporary seasonal or permanent changes, and it may adjust any legitimate path, including CMS content pages.

In brief, some outstanding benefits of URL Rewrites in Magento 2 can be listed here:


Lengthy and complicated URLs distract rather than capture attention, which gives consumers a negative impression of a website. So, rewriting the URLs presents shorter and to-the-point ones.


URL rewrites facilitate webmasters to make technical changes to the site’s structure while also safeguarding the site’s present URLs, which must remain static to improve search engine optimization.

Keywords play a vital role in determining a page’s position in search results. Regardless of technological considerations, rewriting URLs aid SEO professionals in managing keywords inside URLs. More importantly, this method makes it simpler for search engines to crawl.

Nicely to be spotted

The length of URLs that remain in the top ten results is 37 characters on average. Thus, reorganizing and reducing the URLs would effectively improve their ranks and site exposure.

For those reasons, merchants should leverage Magento 2 URL Rewrites to enhance their site performance. 

How to Configure URL Rewrites in Magento 2 

The first thing you need to do when configuring Magento 2 URL rewrites is activating 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, navigate to Stores ⇒ Configuration ⇒ General ⇒ Web.

Expand Search Engine Optimization, set Yes for Use Web Server Rewrites field.


Settings for Use Web Server Rewrites

Then remember to 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 the Catalog section under Catalog.

Navigate to the 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 the 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

Besides automatically redirecting URLs when they are changed, you can easily create Magento 2 URL rewrites for 4 types of pages: product pages, category pages, CMS pages, and Custom pages by navigating to the 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 exporting multiple URL rewrites via a CSV file.  

READ Magento 2 import url rewrites to better your migration NOW!

You need to prepare a CSV file with all data about Magento 2 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 into consideration Magento 2 Import/Export URL Rewrites – Do one CSV file but save many efforts!

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



BSS Commerce is one of the leading Multi-platform eCommerce solutions and web development services providers in the world. With experienced and certified developers, we commit to bringing high-quality products and services to optimize your business effectively. 

CONTACT NOW to let us know your problems. We are willing to support you every time.

Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.