beehexa integrationsidebar
beehexa logo

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

magento migration - url rewrite

Rewrite URL when migrating an eCommerce website to Magento

I recently worked on an interesting project for migrating from an old ASP.NET eCommerce site to the latest version of Magento 2 open source (2.1.9).

A common request is, they want to redirect permanently their old product URL to a new one to the new URL under Magento 2 URL structure.

I suppose that they need to redirect product with old URL:

/productdetail.aspx?ID=99 to /this-is-a-migrated-magento-product-url.html

You may think that it is just simply adding custom URL redirection in Magento URL Rewrite management like the picture below

custom URL redirection in Magento URL

But doing so would bring this URL to a 404 page.

I did a simple trick with .htaccess

RewriteCond %{REQUEST_URI}  ^/productdetail\.aspx$
RewriteCond %{QUERY_STRING} ^ID=([0-9]*)$
RewriteRule ^(.*)$ [R=301,L]

and then, I will add this custom url to magento backend

custom url to magento backend

After that, when visiting

It will be redirected to

I really hope my quick tip will save you guys time for finding a solution to saving the website SEO ranking after migration and avoiding users with annoying 404 errors.

Table of Contents

Ready to integrate and automate at scale ?

Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

Receive Exclusive Productivity Tips Directly in Your Inbox

We’ll email you 1-3 times per week—and never share your information.

Get started for free

You can’t add more hours to the day. Beehexa is the next best thing.