Magento 2 URL Rewrite – Custom URL Rewrite Ignores Query String

magento2magento2.2url-rewrite

I am migrating a store from an old custom commerce system to Magento 2. I am trying to add URL rewrites into Magento 2 using the Marketing -> Url Rewrite tool.

The old URLs for the store look like this:

store/detail/x.php?id=123

I can enter that into the Request Path just fine, but anything with a ? in it never actually forwards to the Target Path. If I remove the ?, it redirects fine.. but obviously that is not a valid URL.

Any ideas or suggestions?

Best Answer

Magento 2 reads parameters in the following format: somepage/param/param_value/

It ignores the question mark. In your situation you have 2 options to go:

1) Manage this by using the rewrite rules of the webserver.

For more information on this, please check:

2) Write your custom router for processing URLs

Please see my example on how to do this there: Configure front name in admin panel

Related Topic