Magento 2 Custom Rewrites: Create and Test

A custom rewrite which is the tool that helps you manage all redirects from your website to another site. You can redirect a product, product catalog or even a page to another website by using a custom rewrite.
The difference of this redirection is that you have to create a new page for custom redirects instead of selecting a page already in your store
The custom rewrite ensures that your store is moved to a new website address even though customers still search for your store at the old address on the search engines.
There are three steps to redirect from your store to another website
Step 1: Prepare before Rewrite
Some people have a trouble because of confusion between “Redirect to” and “Redirect from”
Before starting the redirection, make sure your address you enter is correct
For example: Custom Path
Redirect to: http: //www .new-website. com/new-page.html
Redirect from:
- product.html
- category.html
Step 2: Proceed to create the Rewrite
- From the
Admin sidebar
, go toMarketing
, then SelectURL Rewrites
inSEO & Search
column - To begin the process of creating the Rewrite, you have to verify the
Request Path
is exists, according to the instructions below:- Type the keyword of the website that you want to be redirected into the search filter of
Request Path
column then clickSearch
. Search results will appear and choosing the one that is suitable with your store view then clickEdit
to open the redirect record in edit mode. - After open the redirect record, click
Delete
then chooseOK
to confirm
- Type the keyword of the website that you want to be redirected into the search filter of
- After come back the home of URL Rewrites page, click
Add URL Rewrite
- In the Create URL Rewrite box, select
Custom
- In URL Rewrite Information
- Choose the Store if you have many store views
- In the Request Path field, type the URL keyword and URL (if relevant) of the product, the product catalog or page which is to be redirected ( Redirect from). Make sure the Request Path is unique
- In the Target Path field, enter the new URL of the landing page (Redirect to). You must fill the fully URL if the destination is another website
- In the Redirect Type field, you have 2 options:
- Temporary (302)
- Permanent (301)
- Select
Save
to complete. The new rewrite show at the first list
Step 3: Check the Result
You can easily test the result by going to the home page of your store then navigate to the original “Redirect from” page and then after the store URL, you enter the name of the original “Redirect from”. Then select Enter
The result is the “Redirect to” page will appear instead of the original “Redirect from” page
For your understanding, here are some description of fields
- Create URL Rewrite: Show the type of rewrite which can’t be changed after the rewrite is created. There are 4 options in this field:
- Custom
- For category
- For product
- For CMS page
- Request Path: The path to the product, category or CMS page that is to be redirected
- Target Path: Path or URL is the point of the redirection
- Redirect: Depend on your needs. There are 3 options: No, temporary (302) or permanent (301)
- Description: Describes the purpose of redirecting
Related Post
Abandoned cart email.

Recent Tutorials

Magento 2 Admin Panel
6 Steps to Creating an Extension Package File in Magento
How to build landing pages in Magento store?
Comments for Magento 2 Custom Rewrites
Explore Our Products:
People also searched for
- magento 2 custom url rewrite
- magento 2 custom url rewrite not working
- magento 2 custom module url rewrite
- magento 2 rewrite url
- magento 2 url rewrite not working
- magento url rewrite not working
- magento 2 custom rewrites
- magento 2 redirect back
- magento 2 redirect to homepage
- magento/module-url-rewrite-import-export
- magento 1 url rewrite
- magento contact form redirect to cms page
- magento redirect not working
- magento 2 custom redirect extension
- url rewrite 2
- magento 2 custom redirect
- magento 2 import url rewrites
- magento 2 url rewrites not working
- magento url rewrite
- url rewrite magento
- magento rewrite
- 2.2.x, 2.3.x, 2.4.x
Stay in the know
Get special offers on the latest news from Mageplaza.
Earn $10 in reward now!