With a big catalog of 224+ extensions for your online store
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.
Discover how to Create Product URL Rewrites in Magento 2
What is Magento 2 URL Rewrite tool?
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 changes 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 ID is constant.
There are two types of Magento 2 URL Rewrite including Single URL Rewrite and Multiple URL Rewrite:
Single URL Rewrite
Single URL rewrite refers to the process of creating a custom URL for a specific page in Magento 2. It allows you to rewrite the URL of a particular page to make it more meaningful and relevant. The key features of the Single URL rewrite tool in Magento 2 include:
-
Customization: You can manually define the URL key for each page, ensuring it reflects the content and improves SEO.
-
SEO Optimization: By creating keyword-rich URLs, you can enhance your store’s search engine visibility and rankings.
-
Redirects: Magento 2 automatically manages redirects from the original URL to the rewritten URL, ensuring that seamless user experience.
-
Canonical Tags: The system generates canonical tags to avoid duplicate content issues.
For example, you have a product name “One Step Checkout” with the default URL is “https://example.com/catalog/extension/view/id/1234”. You can creat a custom URL like “https://example.com/one-step-checkout.html“ for better readability and SEO purposes.
Multiple URL Rewrites
Multiple URL Rewrite, also known as “URL Rewrites Management”, allows you to create multiple custom URLs for the same product or page. It is useful when you want to offer different URLs for the same content, such as promotional campaigns or regional variations. There are some key features of the Multiple URL rewrite should be mentioned:
-
Flexibility: You can create multiple custom URLs that point to the same page, offering various entry points for users.
-
Targeted Marketing: It allows you to create specific URLs for marketing campaigns, enabling tracking and segmentation.
-
Regional Targeting: You can create different URLs based on regions or languages, providing localized experiences for your customers.
For example, with the same “One Step Checkout” product, you can create additional custom URLs such as “https://example.com/one-step-checkout.html” “https://example/mageplaza/one-step-checkout-extension.html” Each link will serve for a different purpose or targets a specific audience.
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 Magento 2 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 Magento 2 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 theSearch
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 onOK
to confirm.
-
As you come back to the
URL Rewrites
page, click onAdd 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.
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.
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 and User Experience
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. Clear and meaningful URLs which are easier to read, remember, and share provides a better user experience by giving users an idea of what to expect when they click on. Moreover, Magento 2 URL rewrites can help maintain consistent URL structures, reducing the chances of users encountering broken or dead links.
SEO-friendly
Magento SEO Services
by Mageplaza
Let experienced professionals optimize your website's ranking
Learn moreMagento 2 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 old URLs to SEO Friendly URL can help SEO specialists manage the keywords within URLs no matter what technical contemplations. More significantly, this technique makes it easier for search engines to understand.
Improve Website Structure and Navigation
By incorporating keywords in your URLs to create a logical and hierachical website structure, you can categorize and organize your content effectively, making it easier for users to navigate through your website.
Link Management and Maintenance
Over time, website content could be changed, leading to removing pages or undated URLs. As a result, Magento 2 URL rewrites may offer a method to manage and redirect old URLs to new ones, making sure that both users and search engines can still access the desired content. This helps maintain your website’s link structure and prevent broken links which can impact SEO and user experience.
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.
Magento 2 URL rewrite not working - How to fix it?
After the update, there is an issue with the URL generation for new products in Magento. The current URL format is not as expected, even though the correct settings are configured.
However, it has been observed that when the product category is changed and saved again, the URL rewrite functions properly. Interestingly, even if the original category is restored, the clean URL is generated correctly. Here are 2 methods which can address the issue.
Method 1: Configure as follows:
Configuration >> General >> Web >> Search Engine Optimization >> Use Web Server Rewrites
:Yes
Configuration >> Catalog >> Search Engine Optimization >> Use Categories Path for Product URLs
:Yes
Configuration >> Catalog >> Search Engine Optimization >> Use Canonical Link Meta Tag For Categories
: ``NoConfiguration >> Catalog >> Search Engine Optimization >> Use Canonical Link Meta Tag For Products
:Yes
Method 2: Check and enable Web Server Rewrites To enable URL rewrites
- Stores>Configuration> Web
- Expand the Search Engine Optimization section
- Set Use Web Server Rewrites to “Yes.”
- When complete, tap Save Config Please try updating your rule to the following:
Redirect 301 /store/bra_bust_lift.html /intimates/womens-intimates/bra-converters.html
After updating the rule, you should check if your Apache server needs to be restarted. Additionally, perform a flush of the cache storage. Lastly, make sure to verify if you are using Nginx instead of Apache.
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.
Looking for Magento Development Company?
8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.
Get free consultantRecent Tutorials
How to insert Order Attributes to Transactional Emails
How to insert Order Attributes to Transactional Emails
How to add Order Attributes to PDF Order Template
Explore Our Products:
People also searched for
- magento 2 url rewrite
- url rewrite magento 2
- url rewrites magento 2
- url rewrite in magento 2
- magento 2 url rewrites
- magento2 url rewrite
- magento 2 url rewrite management
- magento 2 url rewrite extension
- magento 2 rewrite url
- rewrite url magento 2
- rewrite magento 2
- magento 2 rewrites
- magento 2 url structure
- magento 2 rewrite
- magento url rewrite
- magento 2 url redirect
- magento 2 url rewrite not working
- magento url rewrites
- url rewrites
- url rewrite magento
- magento url rewrite management
- magento rewrites
- configure url rewrite magento 2
- url rewrite generator magento 2
- magento url rewriting
- url rewrites magento
- magento 2 custom rewrites
- magento 2 url generator
- magento 2 url
- magento 2 redirect url
- 2.3.x, 2.4.x
Stay in the know
Get special offers on the latest news from Mageplaza.
Earn $10 in reward now!