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 The Benefit Of URL Rewrite?
There are two essential benefits from rewriting the existing URLs:
- Support SEO: you can easily change the URLs and make them shorten. Moreover, it might help the Google crawlers understand and read your site better.
- Satisfy your customers: an URL that is well written would also be useful for readers. More particularly, it would show your customers which page they are on and therefore easy to get back to 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 in 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 the URL in Magento 2. Let’s get started!
- Step 1: Go to the admin panel, navigate to STORES and choose Configuration (under Settings)
(Admin Panel => STORES => Configuration)
Step 2: Select Web in the left panel, under the General section
Expand the General section, then choose Web in the dropdown.
Step 3: Expand Search Engine Optimization section
After expanding the Search Engine Optimization, you must select Yes for the only field – Use Web Server Rewrites.
Step 4: Save the config
Finally, you must click on Save Config to complete the URL rewrites configuration.
We have shown you a 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:
How To Config Sitemap in Magento 2?
How To Use Flat Catalog In Magento 2?
How To Create And Manage Coupon Codes In Magento 2
How To Create New Cart Price Rule In Magento 2