英文:
Modify SEO-friendly URL for an article in Joomla 4
问题
我最近将我的网站迁移到了Joomla 4。我正在尝试更改一些文章的SEO友好链接,因为我将它们移到了不同的类别下。为了给您一个我想要实现的示例,我希望链接从:
www.mysite.www/old_category/article-1
更新为类似以下内容:
www.mysite.www/NEW_CATEGORY/article-1
根据我在互联网上找到的信息,我已经在这些文章的设置中更改了类别,并且还清除了缓存(系统->维护->清除缓存),但这没有帮助:文章的URL仍然使用旧的类别。
我错过了什么?
我宁愿避免手动进入数据库并更新这些链接...
英文:
I recently moved my website to Joomla 4. I am trying to change the SEO-friendly link of some articles, since I moved them under a different category. To give you an example of what I am trying to achieve, I want the links to be updated from:
www.mysite.www/old_category/article-1
to something like
www.mysite.www/NEW_CATEGORY/article-1
According to what I have found on internet, I have changed the category in the settings of these articles and also cleared the cache (System->Maintenance->Clear Cache) but that did not help: the url of the article still uses the old category.
What am I missing?
I'd reather avoid to go to the DB and update these links manually...
答案1
得分: 1
以下是翻译好的内容:
Joomla SEF Route 首先查找菜单中的项目类别列表或类别博客(这些是SEF的默认处理程序),在数据库中处理URL的字段是别名。这一切都在表格__menu,__content,__categories上运作。
在源代码中,您可以直接获取URL。
$this->item->alias
但是 Joomla 总是使用 slug。
$this->item->slug
在您的问题中,您需要更改处理类别博客或列表的菜单上的别名,因为您在URL的第一段中。
www.mysite.www/old_category/article-1
如果仍然不起作用,您应该尝试更改一些类别的别名。
所有 Cat 值都存储在带有类别ID的DB __content 中,所以没有问题。因为您只能修改别名,但是ID从不受影响。
英文:
the Joomla SEF Route firstly look on menu which item category list or category blog (these are default handler for SEF), and in DB the field who handle URL is alias. its all worked on table __menu, __content, __categories.
on source look you can get direct url on.
$this->item->alias
but the joomla always use slug
$this->item->slug
on your problem.
you need change the alias on menu who handler category blog or list..
because u are in 1st segment url.
www.mysite.www/**old_category**/article-1
if still not work, you should play with some alias in category..
--------------
All Cat value called CATID stored on DB __content with the id of categories. so there is no problem. because you only can modify the alias. but the id never touched.
答案2
得分: 0
重命名类别后,适当地重建菜单。如果您正在使用任何SEF扩展程序,则还需要检查其设置。
英文:
Rename the category appropriately then rebuild the menu. If you are using any SEF extension , you may need to check on its settings as well.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论