1

我正在启用 Joomla SEF ,当我从主页(首页)文章链接到文章时得到以下结果:

anywebsite.com/component/content/article/26/141-Z1-Z2-Z3-Z4

但是当从其他文章链接时,我得到了我想要的结果:

anywebsite.com/Categor/141-Z1-Z2-Z3-Z4

并且链接都相等,即:

index.php?option=com_content&view=article&id=141:Z1-Z2-Z3-Z4&catid=26 知道吗?!

编辑:手动链接这个 SEF 链接是个好主意,而不是等待 joomla 转换它..?至少作为最后的手段?

4

2 回答 2

1

当没有任何与内容关联的 Itemid(也称为菜单项)时,第一个 SEF URL 是默认的 Joomla SEF 格式。您用来“链接到主页上的文章”的方法不是提供 Joomla 构建 /Category/141... URL 所需的 Itemid。

我建议,如果您想要完全控制,请使用另一个 SEF 管理组件,如 AceSEF 或 sh404SEF,它们往往会为 URL 管理提供更多控制。

于 2010-04-02T01:04:27.717 回答
0

如果您想删除控制器部分,您可以获取默认菜单项并将其 id 推送到路由器的查询中。

在您的路由器中:

if (!isset($query['Itemid']) {
    $app =& JFactory::getApplication();
    $menu =& $app->getMenu();
    $item =& $menu->getActive();

    // Do a check to see if $item is set to something. If no active item, get the default:

    if (!$item) $item =& $menu->getDefault();

    $query['Itemid'] = $item->id;
}
于 2011-08-19T12:58:54.667 回答