有二種方法解決Joomla 404 問題 :
1. 安裝 extension
2. 改 Joomla code
1. Joomla extension :
http://extensions.joomla.org/extensions/site-management/sef
這些 extension 是幫助你的site在SEO 做得更好, 解決404是功能之一。
各extension比較, 一目了然 :
http://www.alledia.com/blog/seo/joomla-15-seo-extension-comparison/
最有名是 sh404SEF, 但是收費的。
2. 改 Joomla code
其實網頁顯示404都有二種error message :
I.
中間紅色box 和顯示404 - Component not found
II.
Not Found
The requested URL /xxx was not found on this server.
這是Joomla official tutorial
http://docs.joomla.org/Tutorial:Create_a_Custom_404_Error_Page
如果看不明, 可以跟我方法, 我是用JA_Puity template
解決 I) 問題 :
1. 複製檔案 由 /templates/system/error.php 去 /templates/ja_purity/error.php
2. 修改檔案 error.php :
在這行之下(約第14行)
defined( '_JEXEC' ) or die( 'Restricted access' );
加入
儲存
if (($this->error->code) == '404') {
header('Location: index.php');
exit;
}
解決 II) 問題 :
在website目錄最上層新加檔案 .htaccess
.htaccess 內容 :
ErrorDocument 404 /index.php
完成後每次user打錯網址, 都會自動轉到首頁。
No comments:
Post a Comment