POP3:void(0)

POPOEVER Official Portal v3

How to fix the 404 error of Joomla article SEF link PDF E-mail
User Rating: / 16
PoorBest 
About Joomla! - The CMS
Written by POPOEVER   
Sunday, 13 April 2008 23:12
Article Index
How to fix the 404 error of Joomla article SEF link
修复 Joomla 1.5.2 搜索引擎友好链接导致的404问题
All Pages

Well , I was suffered from diarrhea last whole week, not available for my current projects physically, so I rambled along with my personal portal on Joomla 1.5.2 during the convalescence.

As a sophisticated Mambo user and somewhat Drupal user, I was very early to have experience with Joomla, cause Joomla is more suitable for a CMS ONLY purpose, it's pretty weak on social network function compared to Drupal, which is a well-round-and-reputed platform being proved by bunch of instances out there.

Joomla 1.5.2 really messed up things, brought me more pains and torments than diarrhea. The big problem is, while turn on Search Engine Friendly URLs option in Global Configuration, some of the article links on the front page lead to a 404: Component not found warning page, and after struggling with your admin CP, you find yourself empty handed, the bad dream just keeps lingering, nothing changed until you turn off the Search Engine Friendly URLs option again, everything back to normal besides leaving this feature in absurd situation.

BUT, THAT OPTION IS BUILT FOR PURPOSE! I WANT TO USE IT! SO WERE YOU! OK! LET'S FIX IT!

Alright, maybe you've already noticed that some of the links had this abnormal 404, some of them don't, why? I found that the articles under those sample database generated sections/categories were had their links always OK while none of those under new added sections/categories were OK, that focused me on something.

Keep studying further more, again I found that those links under default generated sections/categories also have chance of returning 404 while those sections/categories were NOT presented on the front page, in other words, they don't have a component instance on the front page, that's why the link returning 404 has a /component/content/article/ part in the URL other than the section names in the normal ones!

We got the point, here comes the fixie, give those sections/categories their component instances on the front page.

HOW? Add new menu item of those sections/categories to main menu, or other menus that has a presence on the front page, well, that sounds ridiculous, maybe you have a huge sections/categories structure, and you have your main menu on head position in the template, eh......

So, let's try the clean way. Add a new menu titled Sections, remember to fill the module title (let's say sections also for easy recognition), this will add a new module titled sections automatically.

Then add new menu items to Sections menu, item type is Internal Link -> Articles -> Section -> Section Layout, Title is your section title, select the correspondent section name from the dropdown list in the Parameters - Basic field, tuneup with other parameters setting, then save that menu item.

Repeat above work to create menu items for other of your sections, after finishing that, go to Module Manager, setup the display position of your sections module, I suggest you arrange it on the left or right.

Back to you front page, refresh and see what happens, cheers!

Note: The occasion of 404 is comprehensive, this article is only a cure for one or few of them.

Go next page for Chinese Version. 本文的简体中文原文见第二页,谢谢!


  过去的一个星期中,我饱受菌痢腹泻的折磨,忌口弄得我又饿又困,整个人软趴趴的,根本不够力气来做项目的事情,于是我抱着笔记本很随意地用 Joomla 打理一下很久很久没有照料过的个人门户站点。

  我曾是非常有经验的 PHPNuke 用户,用它来定制过数个中型门户站点,随着 PHP CMS 的发展,有一段时间也迷上了曼波 (Mambo),直到现在的猪跑(Drupal),而逐浪 (Joomla) 这个曼波的分支项目 (曼波曾经有过一个商业 CMS 的分支项目,代号探戈,Tango,昙花一现),虽然有过一些试用,却一直没有认真地把玩过,原因是我始终觉得 Joomla 仅仅只能作为内容管理系统,它的内容系统虽然很严谨,但是设置并不容易上手,甚至有时会令人很晕菜,而且它的文件管理功能更偏向于 C/S 的风格,与时下流行的 Web 2.0 轻量化应用风格大相径庭;相比 Drupal 而言,它的社会性网络扩展功能实在弱得可以,连基本的用户角色和等级体制都不很完善,而 Drupal 在开发社会性网络社区这些方面已经是成绩昭彰,有不少可圈可点的成功案例。

  这次 Joomla 1.5.2 确实给我添了不少麻烦,着实叫人头疼。当你在 Global Configuration 里激活 Search Engine Friendly URLs 选项后,站点首页上一部分文章链接便会返回 404: Component not found 的警告页面。在控制台里尝试了各种设置之后发现没有任何结果,噩梦依旧,除非再次禁用 Search Engine Friendly URLs 选项。

  但是,这个选项终归是要给人用的吧!不能聋子的耳朵 —— 摆设啊!下面我们来着手修复这个问题。可能你已经注意到有些链接会出现404,有些则不会,我发现凡是那些样本数据库生成的默认 sections/categories 下面的文章都没有这个问题,而那些在我自己添加的 sections/categories 下的文章链接却没有一个是正常的,其中必有缘故。深入检查后又发现,原来那些默认 sections/categories 下的文章链接也有一些会出现404错误,前提是他们所属的默认 sections/categories 并未在首页出现,换而言之,这些 sections/categories 在首页没有组件的实例,这就是为什么这些链接中会出现 /component/content/article/ 的部分,这在其他正常链接中是没有的。

  既然已经找到问题的症结,修复就不是什么难事,给这些 sections/categories 在首页添加组件的实例。怎么加?很简单,在主菜单 (main menu) 里添加这些 sections/categories 的菜单项,这听上去很搞笑,假如你的站点有庞杂的 sections/categories 结构,碰巧你又像我一样把 main menu 安排在顶部的位置,那么,哦~~~

  我个人认为比较简洁有效的做法是添加一个新的菜单 (menu),名字就叫 Sections,为了方便识别,模块名称 (Module Title) 也填 sections,这样同时会自动生成一个 sections 模块。接下去在 Sections 菜单下添加菜单项,菜单项的类型 (item type) 按照 Internal Link -> Articles -> Section -> Section Layout 来选择,Title 就是 section 的名称,在 Parameter - Basic 表单域的下拉列表中选择对应的 section 名称,继续完成其他设置后保存该菜单项。重复以上这些工作,直到完成所有 sections 菜单项的添加。到模块管理器 (Module Manager) 里设置 section 模块的显示位置,推荐设置成显示在左或者右区块里。回到站点首页,刷新!大功告成!

注意: 404 错误的原因包罗万象,这篇文章并不是万能膏药,可能只是一种状况解药。

Trackback(0)
Comments (2)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
 

Subscribe

Social+

Surveys

Apple or Android?
 
You are here  : Home Joomla! The CMS How to fix the 404 error of Joomla article SEF link