2核1G3M服务器88一季度

腾讯云,阿里云百度云等 折扣价→点我←

SEO超级伪静态 目录化伪静态后,有时点击跳转到错误链接的解决办法 discuz 教程

游客1 游客组

[backcolor=magenta]适用于:[/backcolor]
SEO超级伪静态 V3.6.9 高级版 DZ建站学习研究分享 · 插件(站长窝魔方一代解密学习研究)
https://bbs.zhanzhangwo.com/t-36538-1-1.html
(出处: 站长窝)




部分插件跳转时,没带上网站域名,然后浏览器就默认以当前url路径为前缀进行跳转,导致链接错误
打开:source\function\function_core.php
找到

function dheader($string, $replace = true, $http_response_code = 0) {
        $islocation = substr(strtolower(trim($string)), 0, 8) == 'location';
        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);
                        }
                }
        }
        $string = str_replace(array("\r", "\n"), array('', ''), $string);
        if(empty($http_response_code) || PHP_VERSION < '4.3' ) {
                @header($string, $replace);
        } else {
                @header($string, $replace, $http_response_code);
        }
        if($islocation) {
                exit();
        }
}
修改为
function dheader($string, $replace = true, $http_response_code = 0) {
        global $_G;
        $islocation = substr(strtolower(trim($string)), 0, 8) == 'location';
        if($islocation){
                if(!preg_match('/location:\s*https?:\/\//is', $string)){
                        $string = preg_replace("/location:\s*/is", 'Location: '.$_G['siteurl'], $string);
                }
        }
        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);
                        }
                }
        }
        $string = str_replace(array("\r", "\n"), array('', ''), $string);
        if(empty($http_response_code) || PHP_VERSION < '4.3' ) {
                @header($string, $replace);
        } else {
                @header($string, $replace, $http_response_code);
        }
        if($islocation) {
                exit();
        }
}



站长窝论坛版权声明 1、本帖标题:SEO超级伪静态 目录化伪静态后,有时点击跳转到错误链接的解决办法
2、论坛网址:站长窝论坛
3、站长窝论坛的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
4、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
5、站长窝论坛一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6、本帖由游客1在站长窝论坛《程序综合区》版块原创发布, 转载请注明出处!
评论
最新回复 (0)
返回
发新帖