
While your store URLs constantly undergo different changes one thing often gets overlooked — URL rewrites. When you change the page location or start using higher-value keywords according to the Magento SEO checklist you need to direct visitors to a new URL.
That's exactly what you need the Magento 2 URL rewrites for. Today you'll learn everything about the topic and discover how to automatically handle URL rewrites in Magento.
Post Contents [hide]
What is Magento URL Rewrite?
Magento URL rewrite is a default SEO tool that allows you to change any product, category and CMS page URL and redirect visitors from all old URLs to new ones. It's also a great way to customize page URLs with keywords to make them more SEO-friendly but not lose any traffic or potential of the old URL.
There are two types of Magento URL rewrites that are different in the number of rewrites you can create at once.
Single URL rewrite
Single URL rewrite refers to the process of creating a rewrite for a specific page. It helps you to make URLs more SEO- and user-friendly.
e.g. you have a "Backpack" product with the default URL — https://store.com/catalog/product/view/id/1234. So you create a custom URL rewrite to make it more readable — https://store.com/backpack.
Once the URL rewrite is enabled, Magento will automatically handle the redirection from the old URL to the new one.
Multiple URL rewrites
Multiple URL rewrites allow you to create multiple URLs for the same page. It helps you to prepare your store for some marketing campaigns or seasonal sales.
This improves targeting, and segmentation and enables you to offer URLs based on region or language.
e.g. you have a "Backpack" product with different URLs leading to it:
- https://store.com/backpack
- https://store.com/back-to-school-sale/backpack
- https://store.com/travel/backpack
In case you're wondering, duplicate content won't be an issue since the system will create canonical tags for all those pages.
Enable URL Rewrites in Magento
To enable the Magento URL rewrites for the system URL, navigate to Stores > Configuration > Web > Search Engine Optimization.
This helps you get rid of the system URLs like https://store.com/catalog/product/view/id/1234.
Create URL Rewrites in Magento
To create custom URL rewrites, go to Marketing > SEO & Search > URL Rewrites and click on the Add URL Rewrite button.
Then fill out the URL Rewrite Information:
- Select a Store for which you create this URL rewrite.
- Specify the Request and Target Paths.
- Choose the Redirect Type: Permanent (301) or Temporary (302).
- Give a short Description for your redirect.
Note: the Redirect Path should be unique for a specific store. If you already have a rewrite with the same Request Path, you won't be able to create a new one. In that case, remove the old rewrite to use the Request Path again in a new redirect.
Automatic URL Rewrites
Whenever you have 404 pages or simply need a custom redirect you have to create them manually. This makes you constantly monitor your technical SEO reports. But not unless you use the SEO redirect rules.
They help you to create automatic rewrites for all 404 pages, all broken blog pages, etc. Opportunities are limitless.
Just create a rewrite the same way you do in Magento. The redirect rules will handle the rest automatically.
While so simple, URL rewrites play a major role in your store's SEO. They help you eliminate the 404 pages and avoid losing traffic if you decide to change the URLs.
But note that Magento URL rewrites alone don't cover the technical part of SEO. There are also meta robots, sitemaps and rich snippets you should keep a close eye on.