No Code Attached Yet bug
avatar travisrisner
travisrisner
15 Mar 2023

Steps to reproduce the issue

This happens for sure on Joomla 4.2.9

  • Create a new menu item
  • For Menu Item Type, select System Links -> URL
  • Set the the Link to an internal URL, such as index.php?option=com_content&view=article&id=1
  • Save and visit menu item alias

Expected result

The content of article ID 1 to be displayed when visiting the alias of the menu item, as the description of the menu item says An external or internal URL.

Actual result

Throws a 404 error.

System information (as much as possible)

Joomla 4.2.9
PHP 8.0

avatar travisrisner travisrisner - open - 15 Mar 2023
avatar joomla-cms-bot joomla-cms-bot - change - 15 Mar 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Mar 2023
avatar Quy Quy - change - 15 Mar 2023
Labels Added: bug
avatar Quy Quy - labeled - 15 Mar 2023
avatar richard67
richard67 - comment - 16 Mar 2023

What happens if you use the absolute url, i.e. with the protocol and domain part? It will still be an internal url. An internal url can be given as absolute or as relative url, an external url has to be absolute.

avatar travisrisner
travisrisner - comment - 16 Mar 2023

What happens if you use the absolute url, i.e. with the protocol and domain part? It will still be an internal url. An internal url can be given as absolute or as relative url, an external url has to be absolute.

I did attempt this during my testing, and it was the same result. I believe the problem lies somewhere in the parseSefRoute function in the SiteRouter, but I'm not fully sure just yet. I do know this functionality works fine on Joomla 3.

avatar richard67
richard67 - comment - 16 Mar 2023

The url you have provided is not an SEF url, so why should the SEF router be the problem?

avatar travisrisner
travisrisner - comment - 16 Mar 2023

The URL we are pointing the menu item to isn't SEF, but the alias that should load it that is causing the 404 is an SEF url. You can visit the non-SEF link directly, but it's when you visit the alias that you receive a 404.

avatar Fedik
Fedik - comment - 16 Mar 2023

Save and visit menu item alias

It never worked.
"System Links -> URL" displays an URL that User store in menu options, not an alias.

The error you got it is expected behavior

avatar travisrisner
travisrisner - comment - 16 Mar 2023

It certainly 100% worked in Joomla 3.

avatar Fedik
Fedik - comment - 16 Mar 2023

hm, I see, interesting, it should not work :)

avatar Fedik
Fedik - comment - 16 Mar 2023

But I think now it is a correct behavior.
Because URL menu should show URL instead of magicaly render/redirect from "menu alias" to "menu URL".

@Hackwar can you confirm or deny, please.

avatar joomdonation
joomdonation - comment - 17 Mar 2023

Could be because some code lost when routing code improved. Compare to Joomla 3 behavior, adding an elseif clause below after this line https://github.com/joomla/joomla-cms/blob/4.3-dev/libraries/src/Router/SiteRouter.php#L291 would solve the issue

elseif ($item = $this->menu->getActive())
{
	$uri->setQuery(array_merge($uri->getQuery(true), $item->query));
}

Add a Comment

Login with GitHub to post a comment