There seem to be a few similar questions out there but I am struggling to find one that relates to what I need.
I have a custom module that has a View controller. A sample URL would be:
/our-stores/index/view/id/2
I would like to change this to something similar to:
/our-stores/this-is-a-store
or /this-is-a-store.html
or /our-stores/view/this-is-a-store
I'm sure you get the idea.
I have tried adding a url redirect as follows:
$store_url = str_replace(' ', '-', $store_model->getStoreTitle());
Mage::getModel('core/url_rewrite')
->setIsSystem(0)
->setOptions('RP')
->setIdPath($store_url)
->setTargetPath('our-stores/view/index/id/' . $store_model->getId())
->setRequestPath($store_url)
->save();
This seems to partially work; if I go to /this-is-a-store
it goes to the correct page by changes the URL in the address bar back to /our-stores/index/view/id/2
Can anyone please help me with a nice, clean way of achieving what I need?
If you need anything off me, please ask and I will provide.