discuz手机版链接自动添加&mobile=2,导致百度收录的手机版链接无法打开
解决思路
1.打开/source/class/helper/helper_mobile.php文件搜索下面代码(约在22行):
$content = preg_replace("/href=\"(\w+\.php)(.*?)\"/e", "mobilereplace('\\1', '\\2')", $content);
如上图,将其代码进行注释
2.打开/source/function/function_core.php文件搜索下面代码(约在237行):
function dheader($string, $replace = true, $http_response_code = 0)
将其:
if(defined('IN_MOBILE') && strpos($string, 'mobile') === false && $islocation) {
if (strpos($string, '?') === false) {
$string = $string.'?mobile='.IN_MOBILE;
} else {
if(strpos($string, '#') === false) {
$string = $string.'&mobile='.IN_MOBILE;
} else {
$str_arr = explode('#', $string);
$str_arr[0] = $str_arr[0].'&mobile='.IN_MOBILE;
$string = implode('#', $str_arr);
}
}
}
如上图进行注释
到这一步就完后了,到网站后台更新缓存就可以看到问题解决了