自丢网
标题:
dz!x优化板块信息和帖子不存在时返回404错误
[打印本页]
作者:
admin
时间:
2020-3-2 15:55
标题:
dz!x优化板块信息和帖子不存在时返回404错误
dz!x优化板块信息和帖子不存在时返回404错误
在:
source/function/function_message.php
查找:
$_G['hookscriptmessage'] = $message;
复制代码
上面加入:
if(strpos($message,'nonexistence') !== false || strpos($message,'noexist') !== false || strpos($message,'not_exist') !== false || strpos($message,'nofound') !== false || strpos($message,'no_found') !== false || strpos($message,'not_found') !== false){
header('HTTP/1.1 404 Not Found');
header('status: 404 Not Found');
include('err404.htm');
exit();
}
复制代码
上传覆盖,刷新一个不存在的板块,就会出现404页面提示,而不是系统的板块不存在提示了。
如果是帖子需要404,则修改:source\module\forum\forum_viewthread.php
查找:
$page = max(1, $_G['page']);
复制代码
在上面加入:
if(!$_G['forum_thread'] || !$_G['forum']) {
header('HTTP/1.1 404 Not Found');
header('status: 404 Not Found');
include('err404.htm');
exit();
}
复制代码
后台更新缓存就可以了。
欢迎光临 自丢网 (https://www.zidiu.com/)
Powered by Discuz! X3.5