杰奇CMS做的小说站点由于源码出现时间较为久远,忽略了自动适配&跳转移动端这个功能,导致很多没有技术能力的小说站长损失了移动端的流量,今天给大家分享的这个教程就是针对杰奇站点被转码,或者不自动跳转移动端的问题,话不多说教程开始!
防止转码:
<meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="mobile-agent" content="format=html5; URL=http://m.xxx.com" />//替换成你的手机站地址 <meta http-equiv="mobile-agent" content="format=xhtml; url=http://m.xxx.com" />//替换成你的手机站地址
设备识别跳转:
PC站点跳转移动站点
<script type="text/Javascript"> function browserRedirect() { var sUserAgent = naviGAtor.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsiPhoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i) == "midp"; var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; var bIsAndroid = sUserAgent.match(/android/i) == "android"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; if(bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM){ window.location.href = "wap页面地址"; } } browserRedirect(); </script>
移动站点跳转PC站点
<script> if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ){ }else{ window.location.href="pc页面地址 "; } </script> <script src="http://siteapp.bAIdu.com/static/webapPService/uaredirect.js" type="text/javascript"></script> <script type="text/javascript">uaredirect("http://m.xxx.com/");</script>
伪静态和静态需要的写法以及跳转识别注意事项:
pc页面目录:{?$articleid|subdirectory?}_{?$article_id?}/ pc章节:{?$articleid|subdirectory?}_{?$article_id?}/{?$chapter_id?}.html
pc目录跳转手机目录页面,在pc目录模板里加上的跳转url路径
http://m.你的域名.com{?$articleid|subdirectory?}_{?$articleid?}/
wap跳转pc目录页面,在手机目录模板里加上的跳转url路径
http://ww.你的域名.com/{?$shortid?}_{?$articleid?}/