0

I want to rewrite url like:

https://www.test.com/custom-parent-cat/sub-cat/10-12-14-17-19.html?cat=101

to

https://www.test.com/custom-parent-cat/sub-cat.html

Please help me to achieve this.

Thanks

2
  • check this link magento.stackexchange.com/questions/263293/… Commented Dec 16, 2021 at 9:16
  • This should be done at the server level in nginx or apache configs. If you are using nginx i would recommend using map if you want to make redirect from old urls to new url : tendenci.com/help-files/nginx-redirect-maps . If you want a regex then with nginx you can use a regex to redirect to sub-cat.html when the param cat is present in the query string. Commented Dec 20, 2021 at 21:35

1 Answer 1

0

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:

Nginx - https://www.nginx.com/blog/creating-nginx-rewrite-rules/

Apache - https://httpd.apache.org/docs/2.4/rewrite/remapping.html

  1. Write your custom router for processing URLs

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.