destoon的自动跳转功能,完美符合百度站长平台要求,实现手机端和移动蜘蛛的301跳转,修改方法如下(我们的destoon的wap绑定移动站为m.***.com: 打开template的header.htm,在head中加入: {if $moduleid<4} {php $murl='http://m.***.com';} {else} {if $catid} {php $murl='http://m.***com/index.php?moduleid='. $moduleid .'&catid='.$catid;} {/if} {if $itemid} {php $murl='http://m.***.com/index.php?moduleid='. $moduleid .'&itemid='.$itemid;} {/if} {/if} <meta http-equiv="mobile-agent" content="format=xhtml; url={$murl}"> {php if($murl){ if(preg_match("/(iPhone|mobile|Android)/i", $_SERVER['HTTP_USER_AGENT'])) dheader($murl);}} 打开homepage里的header.htm,加入: {if $file == 'sell' && $itemid} {php $murl='http://m.***.com/index.php?moduleid=5&itemid='.$itemid;} {else} {if $itemid} {php $murl='http://m.***.com/index.php?moduleid=4&username='. $username .'&action='.$file.'&itemid='.$itemid;} {else} {php $murl='http://m.***.com/index.php?moduleid=4&username='. $username .'&action='.$file;} {/if} {/if} <meta http-equiv="mobile-agent" content="format=xhtml; url={$murl}"> {php if($murl){ if(preg_match("/(iPhone|mobile|Android)/i", $_SERVER['HTTP_USER_AGENT'])) dheader($murl);}} 对了,还有修改global fun.php里的dheader函数,加上301功能: function dheader($url) { global $DT; if(!defined('DT_ADMIN') && $DT['defend_reload']) sleep($DT['defend_reload']); header("http/1.1 301 moved permanently"); exit(header('location:'.$url)); } 至此大功告成。 |