1

I have a review page for each product which can be accessed through : "example.com/shop/feedback/review/index/product_id/2931/"

Where feedback is the module, review is the controller and index is the action.

Magento provides an automated URL rewrite for products and category based on urlkey where "example.com/shop/category-name/product-name" is rewritten to "example.com/shop/123/2931" for the router to make sense of the url.

I wanted to know if there is a way where I can rewrite "example.com/shop/feedback/review/index/product-name" to "example.com/shop/feedback/review/index/product_id/2931/" without using the manual url rewrite management tool since there would be hundreds of these pages and I can't really make one manually for each.

1

Out of the box, no, there's no feature in Magento to automatically create URL rewrites for a product's review. I don't know of any extension that does this, but searching through Magento Connect may prove useful.

You could implement a feature like this yourself — on every product save you'd add a custom rewrite object (store in core_url_rewrite for community edition) for your product, and then change the appropriate templates or URL generating code to know about these rewrites, but it would be a non-trivial project that's beyond the scope of a single Stack Exchange answer.

  • as far as I understand the question it is how to move from one custom url structure to another. Not about the url rewriting for reviews default reviews. – Amasty Aug 1 '14 at 8:48
0

As it your module, you can add a redirect in the controller to the new url structure. So inside the action use $this->_redirect('module/controller/action', array('product_id'=>123, var_name'=>'value'));

If you want to add store code or subfolder shop in the url you may also use .htaccess for web-server level url rewrites.

  • Maybe a bit more information here would be useful. – David Manners Aug 1 '14 at 6:55
  • @ David Manners, thanks for the note, will edit the answer when on PC (now from phone) – Amasty Aug 1 '14 at 8:49
  • A redirect would essentially change the URL for the user, which is not what I am looking for. I think a rewrite would be the best way of doing this. Since here you are also assuming I have the product_id, which is not the case if I only have the urlkey of the product. – shilpan Aug 1 '14 at 14:53

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.