自丢网

标题: dz!x优化板块信息和帖子不存在时返回404错误 [打印本页]

作者: admin    时间: 2020-3-2 15:55
标题: dz!x优化板块信息和帖子不存在时返回404错误
dz!x优化板块信息和帖子不存在时返回404错误
在:source/function/function_message.php
查找:  
  1. $_G['hookscriptmessage'] = $message;
复制代码
上面加入:
  1.   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){
  2.               header('HTTP/1.1 404 Not Found');
  3.         header('status: 404 Not Found');
  4.               include('err404.htm');
  5.          exit();
  6.     }
复制代码
上传覆盖,刷新一个不存在的板块,就会出现404页面提示,而不是系统的板块不存在提示了。如果是帖子需要404,则修改:source\module\forum\forum_viewthread.php
查找:
  1. $page = max(1, $_G['page']);
复制代码
在上面加入:
  1. if(!$_G['forum_thread'] || !$_G['forum']) {
  2.         header('HTTP/1.1 404 Not Found');
  3.         
  4. header('status: 404 Not Found');
  5.         
  6. include('err404.htm');
  7. exit();
  8. }
复制代码
后台更新缓存就可以了。





欢迎光临 自丢网 (https://www.zidiu.com/) Powered by Discuz! X3.5