逆风天 发表于 2021-12-4 20:01:48

Discuz 增加404判断


需要修改 /source/function/function_message.php
打开 /source/function/function_message.php 查找
if($param['location'] && !empty($_G['inajax'])) {
include template('common/header_ajax');
echo '<script type="text/javascript" reload="1">window.location.href=\''.$url_forward_js.'\';</script>';
include template('common/footer_ajax');
dexit();
}在这个下面增加
// 404 配置一 Editor By NFTStudio
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 Bot Found');
}

// 404 配置二 Editor By NFTStudio
if(strpos('/no(t_?|n|_|)(found|exist)/i', $message)) {
header('HTTP/1.1 404 Not Found');
}以上代码 任意一种,即可!

页: [1]
查看完整版本: Discuz 增加404判断