2

I have a component with multiple retailers, based on data from an API.

Each retailer has a "read more" link.

Now, what I need, is to give each retailer it's own alias, without having to add an alias / menu item for each retailer in the backend.

So if I click on a specific "read more" link, the normal (non-sef) url is something like:

https://www.mysite.com?index.php&option=com_wherecanisave&retailerID=1

Now in the target page, I do a call to the API again, and look up the retailer's name. Then I want the url to look something like this:

http://www.mysite.com/joes-car-wash

How cab I achieve this without having to add aliases to the backend or database?

  • 1
    It sounds like you wish to write a router for your component: docs.joomla.org/Supporting_SEF_URLs_in_your_component – jamesgarrett Mar 14 '17 at 10:23
  • would be great if someone could actually give some kind of answer, I'm after this same thing and referring to the Joomla docs is a good place to start but I can't seem to figure out how to do this properly. My goal would be to have the url look like the OP has stated, that is without any component or any other string prefixed – doz87 May 9 '17 at 5:00
0

There are at least 2 ways to do it and each one requires an experienced programmer:

Creating custom router

If you are using a custom component you can extend the Router and set this component view as a homepage (that way its component router will became a default router for the website). Here you can find a proper explanation how to do it the right way.

https://docs.joomla.org/Supporting_SEF_URLs_in_your_component

Creating custom System plugin

You can also try to create a proper System plugin and hook into onAfterInitialise and work on redirections or maybe the Application router.

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.