123下一页
返回列表 发新帖
查看: 75|回复: 21

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

[复制链接]

1万

热度

1万

元宝

1万

贡献

金牌草根

发表于 2018-9-19 16:03:13 | 显示全部楼层 |阅读模式
适用于:
SEO超级伪静态 V3.6.9 高级版 DZ建站学习研究分享 · 插件(草根吧魔方一代解密学习研究)
https://www.cgzz8.cn/t-36538-1-1.html
(出处: 草根吧)


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

  1. function dheader($string, $replace = true, $http_response_code = 0) {
  2.         $islocation = substr(strtolower(trim($string)), 0, 8) == 'location';
  3.         if(defined('IN_MOBILE') && strpos($string, 'mobile') === false && $islocation) {
  4.                 if (strpos($string, '?') === false) {
  5.                         $string = $string.'?mobile='.IN_MOBILE;
  6.                 } else {
  7.                         if(strpos($string, '#') === false) {
  8.                                 $string = $string.'&mobile='.IN_MOBILE;
  9.                         } else {
  10.                                 $str_arr = explode('#', $string);
  11.                                 $str_arr[0] = $str_arr[0].'&mobile='.IN_MOBILE;
  12.                                 $string = implode('#', $str_arr);
  13.                         }
  14.                 }
  15.         }
  16.         $string = str_replace(array("\r", "\n"), array('', ''), $string);
  17.         if(empty($http_response_code) || PHP_VERSION < '4.3' ) {
  18.                 @header($string, $replace);
  19.         } else {
  20.                 @header($string, $replace, $http_response_code);
  21.         }
  22.         if($islocation) {
  23.                 exit();
  24.         }
  25. }
复制代码
修改为
  1. function dheader($string, $replace = true, $http_response_code = 0) {
  2.         global $_G;
  3.         $islocation = substr(strtolower(trim($string)), 0, 8) == 'location';
  4.         if($islocation){
  5.                 if(!preg_match('/location:\s*https?:\/\//is', $string)){
  6.                         $string = preg_replace("/location:\s*/is", 'Location: '.$_G['siteurl'], $string);
  7.                 }
  8.         }
  9.         if(defined('IN_MOBILE') && strpos($string, 'mobile') === false && $islocation) {
  10.                 if (strpos($string, '?') === false) {
  11.                         $string = $string.'?mobile='.IN_MOBILE;
  12.                 } else {
  13.                         if(strpos($string, '#') === false) {
  14.                                 $string = $string.'&mobile='.IN_MOBILE;
  15.                         } else {
  16.                                 $str_arr = explode('#', $string);
  17.                                 $str_arr[0] = $str_arr[0].'&mobile='.IN_MOBILE;
  18.                                 $string = implode('#', $str_arr);
  19.                         }
  20.                 }
  21.         }
  22.         $string = str_replace(array("\r", "\n"), array('', ''), $string);
  23.         if(empty($http_response_code) || PHP_VERSION < '4.3' ) {
  24.                 @header($string, $replace);
  25.         } else {
  26.                 @header($string, $replace, $http_response_code);
  27.         }
  28.         if($islocation) {
  29.                 exit();
  30.         }
  31. }
复制代码



本文来源于网友学习研究交流 www.caogen8.co,请以学习研究交流为主。
如果您没有贡献积分,可以直接免费领取,免费领取
如果你需要加入本学习研究交流,请以学习研究交流为目的,免责声明
如果找不到您要的资源,请搜索一下,点击搜索

热度

元宝

贡献

步入草根

发表于 2025-11-10 12:30:00 | 显示全部楼层
支持楼主

热度

元宝

贡献

步入草根

发表于 2025-11-28 19:41:11 | 显示全部楼层
6666666

0

热度

2

元宝

0

贡献

步入草根

发表于 2025-11-28 23:53:32 | 显示全部楼层
支持楼主

22

热度

3

元宝

0

贡献

步入草根

发表于 2025-12-1 10:30:57 | 显示全部楼层
6666666

热度

元宝

贡献

步入草根

发表于 2025-12-2 13:16:20 | 显示全部楼层
看看

热度

元宝

贡献

步入草根

发表于 2025-12-2 18:53:23 | 显示全部楼层
看看

热度

元宝

贡献

步入草根

发表于 2025-12-15 15:24:29 | 显示全部楼层
6666666

2

热度

3

元宝

0

贡献

步入草根

发表于 2025-12-15 18:12:08 | 显示全部楼层
我来看看怎么个事儿

热度

元宝

贡献

步入草根

发表于 2025-12-20 12:40:50 | 显示全部楼层
我来看看怎么个事儿
下一页 »
123下一页
返回列表 发新帖
 懒得打字嘛,点击右侧快捷回复【最新发布】   【赞助草根吧享更多权益】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

收藏帖子 返回列表 搜索

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

小黑屋|手机版|草根吧