Change view question url

  • ZiksOmega
  • 2 months ago


on Joomla 4.1 and Community Answers 5.3.5 i've set the following (menu item type - url/alias):

[Questions layout] -> /main_alias.html

[Categories list: Root] -> /main_alias/view.html

[Categories list: Root] -> /main_alias/resolved.html

[Category: {one category}] -> /main_alias/resolved/{catid_as_alias}.html

My need is to replicate url structure in manual migration from J1.5 (hard and long work, but super necessary for my website with 5M UU/month with strong rankings in SERPs).

What i need to accomplish is to have every single question accessible in the following url structure:


I've edited /components/com_communityanswers/helpers/route.php and added $catid = 0; in order to have

public static function getQuestionRoute ($id, $catid = 0, $language = 0, $start = 0)
$categories = JCategories::getInstance('CommunityAnswers');
$needles = array('question' => array((int) $id));

$link = 'index.php?option=com_communityanswers&view=question&id=' . $id;

$catid = 0;

if ((int) $catid > 1)
$category = $categories->get((int) $catid);
if ($category)
$needles['category'] = array_reverse($category->getPath());
$needles['categories'][] = $needles['category'];
$link .= '&catid=' . $catid;

if ($language && $language != "*" && JLanguageMultilang::isEnabled())

if (isset(self::$lang_lookup[$language]))
$link .= '&lang=' . self::$lang_lookup[$language];
$needles['language'] = $language;

if($start > 0)
$link .= '&start=' . $start;

// add root category to needles in case there is no corresponding category menu item found.
$root = $categories->get('root');
$needles['categories'][] = $root->id;
$needles['questions'] = array(0);

if ($item = self::_findItem($needles))
$link .= '&Itemid=' . $item;

return $link;

Now in main page and in category page i've links with urls in the desired structure:


but all these links lead to 404 pages, and single questions are still accessible via urls with structure


How can i:

- make url structure /main_alias/view/{question_id}-{question_alias}.html work?

- avoid url structure /main_alias/resolved/{catid_as_alias}/{question_id}-{question_alias}.html work?

Thank you in advance!

Access to viewing replies is restricted.
Showing 2 of 2 replies
You do not have permissions for replying to this topic.
Confirm delete? This action is irreversible and the data will be deleted permanently. Do you want to continue? Confirm Add New Delete Unpublish Cancel Import Uninstall The selected item successfully deleted.