Creating URL Rewrites in Magento2

The URL rewrite can be used to create product and category rewrites and custom rewrites for any page in your store. When the rewrite takes effect, existing links pointing to the old URL are seamlessly redirected to the new address.

URL rewrites can be used to add high-value keywords to improve the way search engines index the product. You can also use rewrites to create additional URLs for a temporary seasonal change or a permanent change. Rewrites can be created for any valid path, and including CMS content pages. Internally, the system always refers to products and categories based on their ID. Regardless of how often the URL changes, the ID remains the same. Here are some ways you can use URL rewriting:

It offers these URL rewrite types in Magento:

  • Product Rewrites
  • Category Rewrites
  • CMS Page Rewrites
  • Custom Rewrites

To create URL Rewrites follow below steps:

Step 1: Login to admin panel and go to Marketing -> SEO & Search -> Rewrites.

Step 2: Click on Add URL Rewrite.

Step 3: Here we are going to create Custom URL Rewrites.

Custom Path

Redirect to:

http://Base-URl/page.html

Redirect from:

product.html
cms-page
category.html
category/subcategory.html
category/product.html

Step 4: Create the URL Rewrite Information.

Create URL Rewrite: Select the URL Rewrite type. Here, we are going to select Custom.

Request Path: In the Request Path field, enter the key and URL path, if applicable, of the product page, category or CMS to be redirected.

Target Path: In the Target Path field, enter the destination URL. If the target is on another website, enter the full URL.

Redirect Type: Temporary(302), Permanent(301). Select any one from these two options.

Description: Enter the description.

Step 5: Click on Save button.