How to Create URL Rewrites in Magento 2
As you take visitors from the old pages to the new ones, there is a chance of traffic decrease since the old address is not linked to the new address of the page. Hence, if these problems arise, you need to reactivate the URL Rewrite, which is the default option offered by Magento 2. This option allows you to edit your URL so that customers clicking on the old link will be taken to the new link. Thanks to it, you can see your page with better SEO results, higher traffic and better conversion.
In this article, we’re going to briefly explain what URL Rewrite is, its significance, how it can be used, and show you how to create URL Rewrites in Magento 2 stores. Please follow the post carefully to bring a more wonderful user experience to your shoppers.
What is URL Rewrite?
URL Rewrite is one of the most awesome tools by Magento 2 that allows you to edit any URL linking to a product, category or CMS page. After enabling the rewrite, the visitors who access the old link will be navigated to the new address to get more information.
URL Rewrites enable store owners to insert high-value keywords that support better for the product index by search engines. Moreover, the URL Rewrite tool also allows creating extra URLs for the temporary seasonal change or permanent change while any valid path including CMS content pages can be customized by the URL Rewrite tool. But in spite of the change of the URL, the product ID and categories IDis constant.
Why are URL Rewrites significant?
To grasp why URL rewrites are significant, we need to determine the importance of URLs or uniform resource locators. Understood as a unique identifier to locate a resource on the World Wide Web, it contains a domain name that shows a web browser where to recover a resource. When it refers to your site, these URLs are often the first thing customers and web search engines will find.
Look at these examples:
- https://avada.io/
- https://avada.io/email-marketing/
Both of these links direct you to the same page and their only difference is how they are structured. The first one is related to the server while the second is related not only to the server but also to a product.
Here are some benefits of rewriting URLs:
Simplicity
As you rewrite the URL, it enables you to show shorter and to-the-point URLs since long and intricate ones distract the attention rather than capturing it. This brings users the wrong impression about a site.
SEO-friendly
URL rewrites enable webmasters to technically adjust the site’s hierarchy while still protecting the current URLs of the website, which needs to be static to enhance search engine optimization.
Keywords are essential to a page’s ranking position on Google search results. Rewriting URLs help SEO specialists manage the keywords within URLs no matter what technical contemplation. More significantly, this technique makes it easier for search engines to understand.
High visibility
The average length of URLs staying in the top 10 results is 37 characters. Therefore, restructuring the URLs and shortening them would efficiently boost their rankings and site visibility.
How to Enable URL Rewrites?
These are 3 quick steps for you to enable URL Rewrites:
- Within the admin panel, go to Stores > Configuration > Web
- Go to the Search Engine Optimization tab and set the User Web Server Rewrites to Yes
- Click on the Save Config button
Some ways you can use URL rewrites
There are 4 examples of URL rewrites types that you may want to apply:
System URL
http://www.example.com/catalog/category/id/6
Original URL
http://www.example.com/peripherals/keyboard.html
Redirected Product URL
http://www.example.com/ergonomic-keyboard.html
Additional Category URLs
http://www.example.com/all-on-sale.html
http://www.example.com/save-now/spring-sale
How to Create URL Rewrites in Magento 2?
Now, let’s get started on 3 Steps to Create URL Rewrites in Magento 2:
Step 1. Plan the Rewrite
To prevent mistakes, you should note down the URL of the redirect to page and the URL key of the redirect from page. If you want to make sure, go to each page, and copy the URL from the address bar of your browser.
Step 2. Generate the URL rewrites
- Within the Magento admin, navigate to Marketing > SEO & Search > URL Rewrites
- Before proceeding, you should do the following to check that the request path is available:
- In the search filter at the top of the Request Path column, insert the URL key of the page that will be redirected and click on the Search button.
- If there are many redirect records for the page, choose the one that fits the applicable store view and open it in edit mode.
- In the upper-right corner, click on Delete. When reminded, click on OK to confirm.
- As you come back to the URL Rewrites page, click on Add URL Rewrite
- Determine Create URL Rewrite to Custom
- Under URL Rewrite Information, follow the instructions:
- If you have different store views, choose the Store where the rewrite applies.
- In the Request Path field, insert the URL key and path (if applicable) of the category, product, or CMS page that will be redirected.
Note: The Request Path must be distinct for the specified store. You will notice an error as you try to save the redirect if there is already a redirect using the same Request Path. You must remove the previous redirect before creating a new one.
Within the Target Path field, insert the URL of the address. If the target is on another site, insert the fully qualified URL
Set Redirect to:
- Temporary (302)
- Permanent (301)
For your reference, write a short description of the rewrite.
- Review the following criteria before saving the redirect:
- The Request Path includes the URL key or path of the original redirect from page.
- The Target Path includes the URL of the redirect to page.
- Click on the Save button.
The new rewrite shows up in the grid at the top of the list.
Step 3. Assess the result
- Navigate to the homepage of your site.
- Follow the instructions:
- Go to the original redirect from page.
- In the address bar of the browser, type the name of the original redirect from page instantly after the store URL and choose Enter.
- The new target page shows up instead of the original page request.
Conclusion
It is obvious that URL Rewrites in Magento 2 can assist customers better in remembering the website address, as well as help stores boost search engine rankings.The above-described instructions are the simplest methods to implement if you would like to rewrite your Magento 2 store URL for a brand new page.
If you find this tutorial helpful, feel free to share with your Magento friends and help make everyone’s work easy.