WHAT IS URL REWRITE IN MAGENTO 2?
In simple words, the URL rewrite function in Magento 2 allows us to modify/ edit any URLs in your store (e.g: Urls of the Product page, Category page, CMS page, etc.). After changes, when anybody accesses the old URL, they will be redirected automatically to the new URL.
WHAT IS BENEFIT OF URL REWRITE?
There are two essential benefits from rewriting the existing URLs:
- Support SEO: you can easily change the URLs and make it shorten. Moreover, it might help the Google crawlers understand and read your site better.
- Satisfy your customers: an URL what is well written would also be useful for readers. More particularly, it would show your customers which page they are in and therefore easy to get back if needed.
HOW TO CONFIG URL REWRITE IN MAGENTO 2?
In Magento 2, the objective of URL rewrite is to diminish the index.php file appearing the the URL (after the root folder). Therefore, the remainings are things that are valuable to search engines and your shoppers. Here is an example:
- Without URL rewrite: http://www.example.com/magento/index.php/storeview/url-identifier
- With URL rewrite: http://www.example.com/magento/storeview/url-identifier
In this tutorial, we will show you how to configure URL rewrites in the back-end step-by-step. There are just 4 simple steps to rewrite URL in Magento 2. Let’s get started!
1st step: Go the admin panel, navigate to STORES and choose Configuration (under Settings)
(Admin Panel => STORES => Configuration)
2nd step: Select Web in the left panel, under General section
Expand the General section, then choose Web in the dropdown.
3rd step: Expand Search Engine Optimization section
After expanding the Search Engine Optimization, you must select Yes for the only field – Use Web Server Rewrites.
4th step: Save the config
Finally, you must click on Save Config to complete the URL rewrites configurartion.
We have shown you basic definition of the URL rewrites function in Magento 2 and more importantly, how to configure it in the back-end menu. If you have any problems when following this tutorial, be free to ask us by leaving a comment below. In the next tutorial, we will continue to show you how to generate the automatic redirects when any URL keys of products are changed, see you!
See More Our Magento “How To” Series: