How to write redirect rules for Magento 2 websites; much of the procedure will be familiar to Magento 1 users.
- Log in to your Magento 2 administrative panel.
- In the main menu, click Marketing.
- In the Marketing menu, click URL Rewrites.
- If you are familiar with Magento 1.x, Magento 2 uses the same interface from this point forward. Click Add URL Rewrite.
- Leave the Create URL Rewrite drop-down list on its default setting, Custom. Fill the Store, Request Path, and Target Path fields.
- The Request Path is the original path.
- The Target Path is the new path corresponding to the new web address. This will serve as the target of the redirect rule.
- In the Redirect Type drop-down list, select either 301 or 302, as appropriate.
- Click Save. If successful, you will see the message, “The URL Rewrite has been saved.”