Jump to content

Define SEO Friendly URLs for module internal pages


Recommended Posts

Hi,

I wrote a module, it's a page showing items, each item linksto a detail page. I created two controllers : list.php whitch is the main page, and details.php. Each one have its own template.

 

This is the main page URL :

http://mysite.com/mymodule/list

A click on item #9 opens this :

http://mysite.com/mymodule/details?id=9

 

I'd like to rewrite my urls : I go to admin pannel > Preferences > SEO & URLs, I create a new URL where I find the two pages of my module, it's easy to create a personal URL for the main page (list), but I don't see how to do it to the second page (details) since it requires a parameter, my purpose is to have such URLs :

List (main) page : http://mysite.com/supermodule

Details page :      http://mysite.com/supermodule/details/9

 

This is how I make links from list to details (in list.tpl) :

<a  href="{$link->getModuleLink('mymodule', 'details', ['id'=>$item.id], true)|escape:'html'}">
Details
</a>

Regards :)

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...