Using Magento 2 URL Rewrite to Mass Perfect URL Tree

magento 2 url rewrite

Using Magento 2 URL Rewrite to Mass Perfect URL Tree

Upgrading your URL tree is unavoidable. As your ecommerce expands in all dimensions, the need to perfect your URL structure becomes more and more prevalent.

But here is a problem, how can you handle the massive number that is your URL components? The answer is automation!

READ MORE: Magento 2 URL Rewrite full tutorial

It’s truly a game-changer for your SEO effort. With Magento 2 URL rewrite, you can put everything into motion within seconds.

Let learn how to do exactly that. But first…

Importance of URL tree for Magento business

We spent a lot of time on this blog section talking about the utmost important pieces to an ecommerce website.

URL structure is undoubtedly one of them.


Anyone working in SEO will tell you that you need an as-best-as-you-can URL tree to rank better on the SERP.

This infographic will tell you why:


There are two main benefits within ranking merit that the site architect can bring you: structural benefit and linkability.

If you need a helping hand with basic Magento 2 URL rewrite, we have a full tutorial for you:

CLICK FOR MORE: Producing URL rewrites with the default setting in Magento 2.

For sales betterment

It’s no rocket science. The better your purchasing flow is, the merrier your profit becomes.


A good URL structure will become a strong sales booster as it guides your customers through the entirety of your website. You’ll create a ripple effect with an SEO-friendly URL tree: more product exposure, more sales opportunities, and more UX brownie points.

See Amazon as an example, they’ve created a nearly-perfect navigation through their URL structure that makes them the biggest ecommerce website.

  • Blocking and merging: They organize their products into different categories and find a way to link them together
  • Suggesting with cross-link: They create a non-stop and smooth purchasing experience that ends up with products in the cart
  • Remembering pattern: They re-show the previous products that customers have looked into with more products recommendation

Troubleshoot site architect problems

We’ve talked about how the URL tree is essential to your ecommerce success. Now, let’s cover all the tricky aspects of establishing such a great URL structure.

And of course, there will be solutions for each one of them.

The backbone structure – Flat or Deep

When speaking about the overall structure of a URL tree, we have two models:


Either you go deep or you go flat, aka expand horizontally vs vertically.

While making your site’s engineering, you have to fabricate it with the goal that a client can without much of a stretch find what they desired.

That incorporates making a pecking order of connections that follow a comparable organization to your engineering.

When fabricating that pecking order, you have to do what works best for your clients.

So for client experience, your course of action ought to be to set up a general structure and afterward stick to it.

URLs overload

Beside wiki-type websites, there is no genre of online presence that branches to such a massive degree of pages as ecommerce.

And it’s only going up from there. The number of all URLs you have to organize will multiply as your business becomes bigger. And especially 90% of e-commerce business is struggling with the URL parameters.


The search bar is essential to your online business yet it creates a new URL every time a keyword is entered. These sorts of URLs will flood the record and leave out no room for your index budget.

Hence, you must let Google knows the difference between URLs in Google Search Console.

The permalink – decide what customers and web crawlers see

The permalink is the full URL that both customers and search engines bots see on your current page.

More info to sink your teeth in:

URL anatomy: Protocol - Subdomain -  Domain - Top-level Domain - Folder/Paths - Page - Anchor. 

*Include and exclude these components in the final URL carefully.


You want to make sure your permalink check these list down to a T:

  • SEO-friendly is a must
  • Uniformed and simple are recommended (keep it short and match with the title)
  • Human readable is prioritized (the easier to read the better)
  • Be mindful of the focused keyword

Stay tuned, we will have a deep-dive into how to handle the sheer volume of URLs – technical edition, later down this post!

Clear inventory – Magento 2 delete all URL rewrites

There will be a time that you wish you can undo all of your URL rewrites. And by all, I mean all of them.

Picture this, you’re deleting a number of products on your site and you want to get rid of all URL rewrites related to them. The tricky thing is, you want to keep the categories URL rewrites.

How can you do that? Here are your two option for Magento 2 delete all URL rewrites:

If you want to Magento 2 delete ALL URL rewrites belongs to those products:

DELETE FROM url_rewrite WHERE entity_type='product';

If you want to delete ONLY auto-generated URL rewrites:

DELETE FROM url_rewrite WHERE entity_type='product' AND is_autogenerated='1';

Looping and redirection problem

When it comes to URL structuring, looping your URL rewrites is the worst crime one can commit.


Here is the rule of thumb:

  • Click on URL A -> Get redirect to URL B – Reasonable
  • Click on URL A -> Get to URL B -> Get to URL C – Okay but questionable
  • Click on URL A -> URL B ->… -> URL N – Troublesome

The problem arises when there are more than 2 hops to get to the final URL. At that state, Google will downgrade the viability of the destination site, which means it harder to get that page to rank.

At the same time, you’re putting a burden on customers. A longer string of redirect means it takes a longer time to load for the site, which ultimately translates to a rising bounce rate.

Therefore, try to keep the level of the redirect as low as possible.

Magento 2 URL rewrite reindex

You’ve done rewriting your URL, now what’s next?

The obvious answer is placing it into reality. But here comes a problem, how search engines will react to your new URLs?


To be more specific, how you reload your URL into search engines’ memories – aka reindex. And how long will it take?

If I’m 100% honest, there is no definitive answer. The timing for Magento 2 URL rewrite reindex is wavering due to a number of factors:

  • Whether or not you delete the content of the URL
  • Whether or not you use the Google URL remover tool
  • Whether or not you use redirect with the URL

However, there are shorten routes we can take and we’ll talk about Magento 2 URL rewrite reindex later.

Magento 2 URL Rewrites to the rescue!

We’re finally here at the finish line – here is how you make use of technology for your own convenience.

So you want a solution:

  • To break down the process
  • That easy to follow
  • At the same time, can process huge number of URL rewrites

=> Using a Magento 2 URL rewrite extension to automate your process is the right way to go.


Step 1: Get the sample data

This Magento 2 URL rewrite module comes with a sample CVS file that you can imitate and replicate for your own site.


This step is important because you need to know what goes into a URL rewrite in order to mass-produce with importing.

But I’m getting ahead of myself so here is the second step.

Step 2: Export your current URL rewrites

To know is to grow. You need to start somewhere before jumping directly to the water.


First, let get to know what area you want to improve with URL rewrite. Then Export them with Product, Category,  CMS page, Custom page, and custom page filter.

We also give you the option for exporting URL with store view and redirect type. So you can personalize your URL structuring even more.

Step 3: Do your data off-screen

Remember the sample CVS earlier? Now this time to cross-check it with your exported CVS of URL rewrite.

The job specification of this part is to fill in the gap with your changes. This file will be your new URL component for the next step.

Step 4: Import your URL rewrites

With Magento 2 import URL rewrites, this step is easier than ever.

You can validate your file in a blink to prevent any mistake during the import process.


With that being said, this module still sends out a notification afterward so you can have a final review.


Wrap Up

Hopefully, this post will make your job to create your SEO-friendly URL structure easier and smoother than ever!

The combination of hard work, well-thought strategy with a boost from technology is what you need to make your site rank higher and sell better.

BSS Commerce is one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bring 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.


A proud Content Marketer @BSS Commerce. Addicted to visualized data, SEO, Tech and Marketing wonder-bender with strange terms and cases. Obsessed with cats in general and my two daughters Bean and Butter.

Write A Comment