一、如果织梦网站手机端是动态地址,按照下面的代码来做即可

织梦PC端首页跳转到手机站首页代码(需要加到pc站头部中):

<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}">
<scripttype="text/javascript">if(window.location.toString().indexOf('pref=padindex')!=-1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent)||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}/index.php";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

织梦PC端列表页跳转到手机站列表页代码(需要加到pc站列表页头部中):

<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}/list.php?tid={dede:field.id/}">
<scripttype="text/javascript">if(window.location.toString().indexOf('pref=padindex')!=-1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent)||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}/list.php?tid={dede:field.id/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

织梦PC端内容页跳转到手机站内容页代码(需要加到pc站内容页头部中):

<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}/view.php?aid={dede:field.id/}">
<scripttype="text/javascript">if(window.location.toString().indexOf('pref=padindex')!=-1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent)||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}/view.php?aid={dede:field.id/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

二、如果织梦网站手机端是静态地址并且没有开启绝对路径,按照下面的代码来做即可

织梦PC端首页跳转到手机站首页代码(需要加到pc站头部中):

<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}">
<scripttype="text/javascript">if(window.location.toString().indexOf('pref=padindex')!=-1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent)||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

织梦PC端列表页跳转到手机站列表页代码(需要加到pc站列表页头部中):

<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:type}[field:global.cfg_mobile/][field:typeurl/]{/dede:type}">
<scripttype="text/javascript">if(window.location.toString().indexOf('pref=padindex')!=-1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent)||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:type}[field:global.cfg_mobile/][field:typeurl/]{/dede:type}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

织梦PC端内容页跳转到手机站内容页代码(需要加到pc站内容页头部中):

<metahttp-equiv="mobile-agent"content="format=xhtml;url={dede:global.cfg_mobile/}{dede:field.idrunphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}">
<scripttype="text/javascript">if(window.location.toString().indexOf('pref=padindex')!=-1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent)||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{dede:global.cfg_mobile/}{dede:field.idrunphp='yes'}$result=GetOneArchive(@me);@me=$result['arcurl'];{/dede:field.id}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

其中cfg_mobile这个是手机域名地址,你可以在织梦后台系统变量里新建变量,变量值是手机域名

织梦手机端访问pc端网站自动跳转手机端三种情况

三、如果织梦网站手机端是静态地址并且开启绝对路径,按照下面的代码来做即可

免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。