J3 Issue ?
avatar pjdevries
pjdevries
3 Apr 2018

Steps to reproduce the issue

In admin side code:

use \Joomla\CMS\Router\Router;
$router = Router::getInstance('site');
$routedUrl = $router->build('index.php?option=com_content&view=article&id=1&Itemid=1');
$routedUrlAsString = $routedUrl->toString();

Expected result

For menu item with alias 'foo' pointing at article 'bar':

https://my.site.tld/foo/bar

Actual result

https://my.site.tld/administrator/foo/bar

System information (as much as possible)

Additional comments

Method SiteRouter::build($url) prefixes the constructed SEF url with \JUri::base(true). When invoked from within admin code, JUri::base() returns an uri containing '/administrator', which is not the intention for a site SEF url.

avatar pjdevries pjdevries - open - 3 Apr 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Apr 2018
avatar mbabker
mbabker - comment - 3 Apr 2018

This is probably addressed by #16879 and I'm not so sure there is anything sane to be done for 3.8 other than having a helper method that parses and removes the /administrator segment.

avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Apr 2018
Status New Discussion
avatar pjdevries
pjdevries - comment - 3 Apr 2018

As far as I can see, the use of JUri::base() seems to be the main culprit. Other than that the constructed SEF url looks fine.

For my purpose, removing /administrator is exactly what I do now 😄


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20070.

avatar brianteeman brianteeman - change - 3 Apr 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 3 Apr 2018
avatar brianteeman
brianteeman - comment - 23 Jul 2018

As #16879 has been merged I am going to close this at this time. It can always be reopened if needed if that didnt solve it.

avatar brianteeman brianteeman - change - 23 Jul 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-07-23 19:20:12
Closed_By brianteeman
avatar brianteeman brianteeman - close - 23 Jul 2018

Add a Comment

Login with GitHub to post a comment