How to setup and create URL rewrites in Magento 2

Magento 2 URL Rewrite Tool

URL Rewrite is one of the most useful tools that come out of the box with Magento 2. It allows you to create multiple temporal server URL redirects for any product, category or CMS page directly from the admin panel, which is great for seasonal sales or promotions or permanent if you simply want to overwrite a URL. To start using this tool you must first enable it and then just create as many as you want as explained in the steps below.

Steps to enable URL Rewrite tool:

To enable URL rewrites

  • Go to Stores > Settings > Configuration > General > Web in the left toolbar menu.
  • Expand the Search Engine Optimization section.
  • Set Use Web Server Rewrites to “Yes”.
  • When complete, click the Save Config button.

Steps to create new URL Rewrite rules:

Step 1:

Log into your Magento 2 Store Admin panel.

Magento Login

Step 2:

Click on “Marketing” option on the left toolbar.

Magento Marketing Menu

Step 3:

Click on “URL Rewrites” option under “SEO & Search”

URL Rewrites Menu

Step 4:

Click on “Add URL Rewrite” button located on the top right corner.

Add URL Rewrite Button

Step 5:

Select “Custom” from the “Create URL Rewrite” drop-down menu.

Magento Custom URL Option

Step 6:

Select “Default Store View” from the “Store” drop-down menu.

Magento Default Store View Option

Step 7:

Enter the current URL  (the URL you want to overwrite) in the “Request Path” text field.

Magento Request Path Input

Step 8:

Enter the target URL (the new destination URL) in the “Target Path” text field.

Magento Target URL Input

Step 9:

Select the redirect type as “Temporary (302)” if you want to do it only for some time or “Permanent (301)” if it is a permanent redirect from the “Redirect Type” drop-down menu.

Magento Redirect Type Select

Step 10:

Click the “Save” button at the top right corner to finally save the new URL Rewrite.

Save Button Magento URL Rewrite

The URL Rewrite tool in Magento 2 is really flexible and allows you create as many Temporary (302) or Permanent (301) redirects as you want with ease. Thank you all for reading the post and if it was useful don’t forget to share it with your colleagues.

See you again in the next article.

Leave a Reply

Your email address will not be published. Required fields are marked *