1

In magento 2, I want to do like this below way :

http://php722.local.com/m231/products/category1 => This is category url (Products is main category and category1 is sub-category of products)

Now, there are 2 tabs available in category1 category

  • video
  • photos

Expected Result :

Now, If I execute this below url then, it should not be return 404

http://php722.local.com/m231/products/category1/?tab=video

http://php722.local.com/m231/products/category1/?tab=photos

http://php722.local.com/m231/products/category1/video

http://php722.local.com/m231/products/category1/photos
  • If 1st url execute then, video tab should be active & if 2nd url execute then, photos tab should be active.

Actual Result :

Right now, it's return 404. I think it's consider as action name and action will be not found so.

What should i need to do ? Is there any way to override url rewrite file or plugin ?

Any help would be appriciated.

Thanks.

0

The query part of the URL needs to be before the #. Browsers only send the part before the # to the server. The part after # is for auto-scrolling to elements using the element id attribute.

Try to hit the URL http://php722.local.com/m231/products/category1#video or http://php722.local.com/m231/products/category1#photos

where photos and videos are id of the element.

Reference : https://en.wikipedia.org/wiki/URL#cite_ref-14

  • I can't able to use #. Because, That url is already live and also in seo. – Rohan Hapani Apr 25 at 6:19
  • Can you please suggest me how to do using ?tab= .... In M1, it's working from app/code/local/Mage/Core/Model/Url/Rewrite.php loadByRequestPath() function. How to do in M2? – Rohan Hapani Apr 25 at 6:21
  • Not sure, may be you need to write custom module to process this type of URLs which contains video and photo query params. – Anshu Mishra Apr 25 at 6:36
  • Do you know about core url rewrite M2 function which is useful to make working as like product page ? – Rohan Hapani Apr 25 at 7:26
  • Not sure, need to check. – Anshu Mishra Apr 25 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.