Menu items and urls extending

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
kennm
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Thu Jul 26, 2018 12:54 pm

Menu items and urls extending

Post by kennm » Tue Mar 28, 2023 1:31 pm

In old Joomla 3 we used custom component which was used just to display custom content depending on what url was. We noticed that there was possibility to add anything after basic url of the menu item's url after it base url, for instance if menu item was "category", then we were able to display the same page with these urls:

/category
/category/whatever
/category/whatever/a
/category/whatever/a/b
/category/whatever/a/b/c/d/e/f/g
...

No matter how many "/" chars we added in the url, always was called the same menu item and displayed the same page.

In Joomla 4 it seems to not work, i.e. /category and /category/something don't lead to the same page - in the latter case we get 404 error.

How can we achieve the same effect in Joomla 4 for these urls related to the same menu item? I.e. to not get 404 error with /category/..... url but leading to the same menu item's page as with just /category url?

tigaz
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Fri Dec 02, 2016 12:26 am

Re: Menu items and urls extending

Post by tigaz » Thu Mar 30, 2023 8:22 am

Hi kennm

It has to do with the routing in Joomla. Could you please check if the .htaccess file has been enabled on your site in Joomla 4 (if it was that in Joomla 3)? Please ensure your settings for "Search Engine Friendly URLs" and "Use URL Rewriting" hasn't changed either after changing to Joomla 4. When that's said the routing has been changed in J4.

You might need to rewrite the code of the router in the custom component to make it work as expected.
https://componentgenerator.com/ - Joomla component creator
https://unikplakat.dk/ - Unik Plakat

kennm
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Thu Jul 26, 2018 12:54 pm

Re: Menu items and urls extending

Post by kennm » Thu Mar 30, 2023 11:41 am

tigaz wrote:
Thu Mar 30, 2023 8:22 am
Hi kennm

It has to do with the routing in Joomla. Could you please check if the .htaccess file has been enabled on your site in Joomla 4 (if it was that in Joomla 3)? Please ensure your settings for "Search Engine Friendly URLs" and "Use URL Rewriting" hasn't changed either after changing to Joomla 4. When that's said the routing has been changed in J4.

You might need to rewrite the code of the router in the custom component to make it work as expected.
Thank you for the reply.

We have "Search Engine Friendly URLs" and "Use URL Rewriting" exactly the same as in J3. The .htaccess is exactly the same as in J3, and it works fine, however still treating of URLs by J4 seems different than in J3.


Locked

Return to “Joomla! 4.x Coding”