Sign up to receive email updates and to hear what's going on with our magazine!
Magento 2 offers some options that help to optimize the SEO of your Magento 2 store. Redirects are the most common approach developers use in web applications. Redirect usually means a rule or set of rules which helps to forward the user from one URL to another URL. When the rule goes into effect, any link that points to the targeted URL is redirected within seconds. URL redirection also makes your existing URLs more search engine friendly.
In Magento 2, you can easily write the Redirect Rules by using the Magento 2 Admin Panel. Let’s take the following steps to redirect a custom URL to our targeted URL:
Step 1: Login to your Magento 2 Store Admin Panel.
Step 2: From the left sidebar, click “Marketing“.
Step 3: Under the “SEO & Search” menu, tap “URL Rewrites“.
Step 4: Click “Add URL Rewrite” button.
Step 5: Select “Custom” from the drop-down list of the “Create URL Rewrite.”
Step 6: Select your default store view from the drop-down in “Store” field.
Step 7: In the “Request Path” field, enter the Requested URL. (Requested URL is the previous URL which will redirect to the targeted URL)
Step 8: In the “Target Path” field, enter the Targeted URL which will serve as the target of the redirect rule for Requested URL.
Step 9: Select either “Temporary (302)” or “Permanent (301)” in the “Redirect Type” using the drop-down list.
Step 10: Tap “Save” button when you are done and you will see the success message “The URL Rewrite has been saved“.
The above is a simple guide to write a URL Redirect Rule in Magento 2. This is a good practice to make your Magento 2 Store more SEO friendly and also helps to point your old URLs to the new ones so the user can stay longer on your website. If you have any question related to this tutorial, feel free to share your point in the comments section.
Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. He writes about Magento Tutorials at Magenticians as well as share his knowledge with the Magento Community. Fayyaz is a food lover and enjoys driving. You can email him at firstname.lastname@example.org