建站服務(wù)器
這篇文章主要介紹phpcms配置404的方法,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
phpcms是一款網(wǎng)站管理軟件。該軟件采用模塊化開發(fā),支持多種分類方式,使用它可方便實現(xiàn)個性化網(wǎng)站的設(shè)計、開發(fā)與維護(hù)。它支持眾多的程序組合,可輕松實現(xiàn)網(wǎng)站平臺遷移,并可廣泛滿足各種規(guī)模的網(wǎng)站需求。
在phpcms v9系統(tǒng)中設(shè)置404錯誤頁的方法:
1、在網(wǎng)站根目錄,建一個page404.php文件,內(nèi)容為:
<?php header('http/1.1 404 not found'); ?>或:
<?php header( $_server['server_protocol']." 404 not found", true, 404 ); ?>或:
<?php header( $_env['server_protocol']." 404 not found", true, 404 ); ?>2、在函數(shù)庫中定義404頁面。
修改phpcms/libs/functions/global.fnc.php,最后位置,插入:
function page404(){ header($_server['server_protocol']." 404 not found", true, 404 ); require('page404.php'); exit(); }3、在phpcms/module/content/index.php中找到lists和show方法,修改插入:
show方法:
if(!$catid || !$id) page404()if(!isset($categorys[$catid]) || $categorys[$catid]['type']!=0) page404()if(!$r || $r['status'] != 99) page404()lists方法:
if(!isset($categorys[$catid])) page404()這樣修改,當(dāng)碰到上面的情況就會返回狀態(tài)碼404。
以上是phpcms配置404的方法的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注資訊頻道!