There are cases when you want to change page URLs or disable some page and avoid 404 error. Unless you create Magento 2 auto redirects, you need to create 301 redirects manually.

In order to add 301 redirect in Magento 2 take the following steps:

1. Go to Admin Panel > Marketing > SEO& Search > URL Rewrites.

Magento 2 301 Redirect

2. Then press the Add URL Rewrite button.

Magento 2 301 Redirect, Add URL Rewrite

3. Enter URL Rewrite Information

  • Choose "Custom" in Create URL Rewrite select box.
  • Choose the store view you want the URL Rewrite to be added to in the Store field.
  • Set the path you want to be redirected in the Request Path field.
  • In the Target Path, you correspondingly set the path you want the old one to be redirected to.
  • Choose Permanent(301) in the Redirect Type field.
  • Enter short information why you add this rewrite in the Description text box (optional).

Magento 2 301 Redirect, URL Rewrite Information

Attention! Do not enter either domain or store view code in the request and target paths.

4. Once you have finished creating the redirect don't forget to save it by pressing the Save button.

Sometimes you may face the unexpected 301 or 302 redirects in your Magento 2 caused by some code, including the too many redirects error. To find out the reasons for it to appear you need to debug 301/302 redirects in Magento 2.