• Home
  • Get help
  • Ask a question
Last post 2 hours 28 min ago
Posts last week 110
Average response time last week 29 min
All time posts 67418
All time tickets 10424
All time avg. posts per day 21

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#7720 – Custom Joomla Router Rules

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Tuesday, 20 April 2021 12:48 UTC
02_pepe

Hello,

I had to modify the routing of a 3rd party component (EasySocial). So I created a Joomla plugin to add Custom Rules to the Joomla Routing System:

$router->attachBuildRule($myBuildCallback,"postprocess"); $router->attachParseRule($myParseCallback,"preprocess");
Now I have the problem that these created URLs are not picked up by the sh404 component. Do I have to consider important steps inside my Rule for this to happen? What is the general approach with a custom routing rule?   Thanks in advance  
Peer 
Tuesday, 20 April 2021 12:57 UTC
wb_weeblr

Hi

That parse or build rules would have no effect on sh404SEF rule building process, which is itself triggered by build and parse rules but takes over from there.

Only modifying the router.php file would have any effect here. Or having a custom sh404SEF plugin, which was the case with EasySocial at some point, not sure they still have it though.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Wednesday, 21 April 2021 13:20 UTC
02_pepe

Hi,

there are 3 different stages where you can register a rule in the Joomla Router: pre, during, post.

When I add my rule to the post stage, I can modify the URL and the modification is shown in the frontend.  But I guess this is stage is too late for sh404 to pick up my modifications. Today I tried to move my rule one stage earlier into the during stage. Looking at the code of the sh404 component I think it also adds their rules in this stage.

Now I have the issue, that my rule is applied before the sh404 component. With "URL optimization" turned on, my URLs are now beeing overwritten. I assume it is because of the sh404 component because if I turn off "URL optimization" my URL are staying the way I want them to be.

I only alter URLs inside the EasySocial component and they use sh404 aswell. It would be very nice if I could manage my modified URLs inside of the sh404 component aswell since it would save me time building a new component just to manage SEF URLs for one component.

Do you have any solutions or any ideas where to start?

Thanks in advance

Peer 
Wednesday, 21 April 2021 13:38 UTC
wb_weeblr

Hi

there are 3 different stages where you can register a rule in the Joomla Router: pre, during, post.

I wrote sh404SEF, I guess it's fair to say I'm excessively familiar with the Joomla router process.

 But I guess this is stage is too late for sh404 to pick up my modifications.

sh404SEF will not use any of the rules attached to the router. It does not use the Joomla router at all to build URLs, so nothing from it, or related to it, is used.

Now I have the issue, that my rule is applied before the sh404 component. 

As said above, your rule are likely applied by the router but none of what the router does is used in the actual SEF URL.

With "URL optimization" turned on, my URLs are now beeing overwritten. I assume it is because of the sh404 component because if I turn off "URL optimization" my URL are staying the way I want them to be.

When URL optimization is set to No, sh404SEF is entirely disabled, it's like it's not installed on the site.

I only alter URLs inside the EasySocial component and they use sh404 aswell. It would be very nice if I could manage my modified URLs inside of the sh404 component aswell since it would save me time building a new component just to manage SEF URLs for one component.

Do you have any solutions or any ideas where to start?

First, forget about rules attached to the Joomla router, that's a dead end, rules are not used, so you cannot modify URLs that way.

This part of my previous response applies here:

Only modifying the router.php file would have any effect here. Or having a custom sh404SEF plugin, which was the case with EasySocial at some point, not sure they still have it though.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 

 

 
Saturday, 22 May 2021 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.