1

I created a custom module for news. I need to change url structure for detail page.

My current news detail page url something like this

www.domain.com/news/detail/?id=4

I need following url www.domain.com/news/detail/id/4/ or www.domain.com/news/id/4/

0

In order to fulfill,your requirement , need to implement custom route. By using custom route,your requirement will be fulfilled.

How to implement custom route see.

if you have using Ivan answer then you need to modification at match() function basic of your logic & requirment

Use Core Rewrite:

Also if do not use custom route then use magento Core rewrite

and use clockworkgeek .

$rewrite = Mage::getModel('core/url_rewrite');
$rewrite->setStoreId($store_id)
        ->setIdPath('news/'.$id)
        ->setRequestPath('news/detail/id/'.$id)
        ->setTargetPath('news/detail/index/id/'.$id)
        ->setIsSystem(true)
        ->save();

Here i assume, details is Controller name =DetailsController.php index is an action name of DetailsController.php controller.

|improve this answer|||||

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.