URL rewrites are an important component of search engine optimization (SEO). They allow you to create user-friendly and search engine-friendly URLs instead of default URLs. URL rewrites also prevent duplicate content issues and improve website navigation.
In this article, we will guide you through the process of configuring URL rewrites in Magento 2.
Table of Contents
Step 1: Enable URL Rewrites
Before you configure URL rewrites, make sure that “Use Web Server Rewrites” is enabled in your Magento 2 store. To enable this setting, follow these steps:
- Log in to the Magento 2 Admin Panel.
- Go to Stores > Configuration.
- In the left sidebar, click on Web.
- Expand the Search Engine Optimization section.
- Set Use Web Server Rewrites to Yes.
- Click Save Config.
Step 2: Set Up URL Rewrites
After enabling URL rewrites, you need to set up specific rewrites for your store. Here is how to create a URL rewrite in Magento 2:
- Log in to the Magento 2 Admin Panel.
- Go to Marketing > SEO & Search > URL Rewrites.
- Click Add URL Rewrite.
- Select Custom from the Create URL Rewrite drop-down menu.
- Select the store view for which you want to create the URL rewrite.
- Enter the Request Path (old URL) that you want to redirect.
- Enter the Target Path (new URL) that you want to redirect to.
- Select the Redirect Type. There are three types of redirects available: Permanent (301), Temporary (302), and No (0).
- Click Save.
Step 3: Verify URL Rewrites
After setting up URL rewrites, it’s important to verify that they are working correctly. You can verify URL rewrites by following these steps:
- Go to the front-end of your Magento 2 store.
- Click on a link that you previously modified with the URL rewrite.
- Verify that the new URL is displayed in the browser address bar.
- Verify that the content on the page matches the content of the old URL.
Step 4: Delete URL Rewrites
If you no longer need a URL rewrite, you can delete it by following these steps:
- Log in to the Magento 2 Admin Panel.
- Go to Marketing > SEO & Search > URL Rewrites.
- Find the URL rewrite that you want to delete.
- Click on the checkbox next to the URL rewrite.
- Click Delete Selected.
- Confirm the action by clicking OK.
Conclusion
URL rewrites are essential for a successful SEO strategy. By configuring URL rewrites in Magento 2, you can improve your website’s user experience, search engine rankings, and overall performance. With the steps outlined in this article, you can easily create, verify, and delete URL rewrites in Magento 2.