Christmas Sale: 20% off on all products. Coupon code: FMECS2024
Magento 2 URL Rewrite: How To Create, Manage & Regenerate?
Over the years, certain pages on your website may no longer be active. You either removed the product categories or set up a new page. Pages which are no longer active are referred to as dead or broken links. If a user clicks on a dead link, they expect to be diverted to the relevant page. If that doesn’t happen, it impacts the user experience. Instead of dedicating time to finding the right link, they will simply move to another site.
Therefore, it is imperative to fix such links. This is where the Magento 2 URL rewrite function comes into play. It allows you to edit the dead URL and replace it with an active one. Thus, when a user clicks on the old link, they are automatically diverted to the new one. This prevents your site’s traffic from going down besides ensuring a seamless user experience.
The Need to Change URLs
Of course, this is not the only reason you need to change the URLs. More often than not, Magento merchants need it in order to make their URLs fancy & more search engine friendly, i.e. searchable and readable. URL rewriting allows them to fill their URLs with keywords without affecting the store’s underlying structure. Once you configure URL rewrites in Magento 2, you’ll see a noticeable improvement in traffic and conversion rate.
Now, the question arises as to how to configure URL rewrites in Magento 2. This is precisely what we intend to cover in this detailed guide. There are two ways to set up Magento 2 URL rewrites – admin panel and programmatically. Let’s go through the Magento 2 URL rewrites through the admin panel in detail. If you lack the know-how or feel uncomfortable making the changes, reach out to our support team now.
Setting up Magento 2 URL Rewrite from the Admin Panel
Step 1: How to Enable Magento 2 URL Rewrite?
First of all, you need to enable URL rewrite in Magento 2. Follow these steps:
Step 2: Automatically Enable URL Redirects
Now, after enabling the URL rewrites, you need to enable the Magento 2 URL redirects. The main purpose of this is to permanently redirect all the old URLs to the latest URL.
- Go to Stores -> Configuration -> Catalog
- Now in Catalog drop-down again Click Catalog
- Expand the Search Engine Optimization section
- Set Create Permanent Redirect for URLs if URL Key Changed to ‘Yes’.
- Click the “Save Config” button to save your settings.
Now, you can easily update/regenerate the product and category url key and all old urls will be redirected to the new ones.
Step 3(a): Enable Magento 2 Product URL Rewrite
Now, in order to generate URL rewrite for products, follow these steps:
- Navigate to CATALOG -> Products.
- Select the product(s) that you want to change the URL of.
- Expand the Search Engine Optimization menu
- Update the URL Key to the new one. Remember, only lowercase letters & characters are allowed.
- Save the changes and refresh the cache.
If product url rewrite is not working, make sure you have cleared the cache. Upon doing this, all the old ULRs will be redirected to the updated ones.
Step 3(b): Enable Magento 2 Category URL Rewrite
If you're looking to update category URL, then follow these steps:
- Navigate to CATALOG -> Category.
- Select the product(s) that you want to change the URL of.
- Expand the Search Engine Optimization menu
- Update the URL Key to the new one. Remember, only lowercase letters & characters are allowed.
- Save the changes.
If category url rewrite is not working, make sure to refresh the cache. After refreshing cache, all the old category ULRs will be redirected to the regenerated category url.
Magento 2 URL Rewrite Management
Store admin can easily manage all the generated url rewrite from the admin panel. Magento records all the url rewrites in a single grid.
Ready Made Solution: Magento 2 Import Export URL Rewrites Extension
Check Magento 2 URL Rewrite Record
If you want to check what custom URL rewrites have you made, do the following:
On the Admin Panel, navigate to MARKETING -> URL Rewrites under SEO & Search section.
It will show you a table of all the regenerated URL Rewrites with the most recent on the top.
In case you see that some changes have not been applied, you can reindex from admin panel or CLI.
Check this article to programmatically add URL rewrite in Magento 2.
Conclusion
Magento 2 URL rewrites is something you must know if you wish to enhance your store’s performance and online visibility. In this article, we have listed the easiest method of doing so. Still got questions? If you have any issue in managing URL Rewrite in Magento 2, you can contact our support team by submitting a ticket here.
Related Articles:
This blog was created with FME's SEO-friendly blog