杰奇cms2.4 PC跳移动识别跳转js跳转规则附带伪静态的设置

2020年12月28日主机教程评论637789字

相对于二次开发那些,这个确实是算简单的了,只需要根据网上的js自己补充而已,但是相对于每个模板都配置一条跳转规则,我还是有个简单的办法,不过还是得配合已经设置好的伪静态。在这篇教程里,小编就简单说明一下电脑和手机端两边的配置文章源自主机测评-https://.zjcp.org/14190.html

杰奇cms2.4 PC跳移动识别跳转js跳转规则附带伪静态的设置文章源自主机测评-https://.zjcp.org/14190.html

比较重要的页面主要是首页,书库,分类,小说信息,充值,目录,小说阅读,但是一般来说目录和小说阅读的头部是放置在单个文件中,不和其它页面共用。文章源自主机测评-https://.zjcp.org/14190.html

假如:文章源自主机测评-https://.zjcp.org/14190.html

电脑端网址为:pc.xx.com文章源自主机测评-https://.zjcp.org/14190.html

手机端网址为:wap.xx.com文章源自主机测评-https://.zjcp.org/14190.html

教程开始文章源自主机测评-https://www.zjcp.org/14190.html

首先是PC端的修改文章源自主机测评-https://www.zjcp.org/14190.html

1.在PC端的/themes/目录中找到当前设置的模板,进入后找到theme.html,在它的head标签对中加入如下代码:文章源自主机测评-https://www.zjcp.org/14190.html

<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(/ ce/i) == "windows ce";
  var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  if(bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM){
  {?if $jieqi_thisfile|basename == 'articlefilter.php'?}
  window.location.href = "http://wap.xx.com/modules/article/articlefilter.php";
  {?else if $jieqi_thisfile|basename == 'articlelist.php'?}
  window.location.href = "http://wap.xx.com/sort/{?$sortid?}/1.html";
  {?else if $jieqi_thisfile|basename == 'buyegold.php'?}
  window.location.href = "http://wap.xx.com/modules/pay/buyegold.php";
  {?else if $jieqi_thisfile|basename == 'articleinfo.php'?}
  window.location.href = "http://wap.xx.com/book/{?$articleid?}";
  {?else?}
  window.location.href = "http://wap.xx.com/";
  {?/if?}
  }
}
browserRedirect();
</script>

2.目录页和章节页头部可能在themer.html,也可能是/modules/article/templates/里面的style.html和index.html,同样是在head标签对加入如下代码。文章源自主机测评-https://www.zjcp.org/14190.html

<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(/ ce/i) == "windows ce";
  var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  if(bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM){
  {?if $jieqi_thisfile|basename == 'reader.php'?}
  window.location.href = "http://wap.xx.com/index/{?$articleid?}/1/asc";
  {?else if $chapterid != ''?}
  window.location.href = "http://wap.xx.com/book/{?$articleid?}/{?$chapterid?}.html";
  {?else?}
  window.location.href = "http://wap.xx.com/";
  {?/if?}
  }
}
browserRedirect();
</script>

然后是WAP端的修改:文章源自主机测评-https://www.zjcp.org/14190.html

1.在WAP端的/themes/目录中找到当前设置的模板,进入后找到theme.html,在它的head标签对中加入如下代码:文章源自主机测评-https://www.zjcp.org/14190.html

<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(/ Phone/i)
    ){
  }else{
  {?if $jieqi_thisfile|basename == 'articlefilter.php'?}
  window.location.href = "http://pc.xx.com/modules/article/articlefilter.php";
  {?else if $jieqi_thisfile|basename == 'articlelist.php'?}
  window.location.href = "http://pc.xx.com/sort/{?$sortid?}/1.html";
  {?else if $jieqi_thisfile|basename == 'buyegold.php'?}
  window.location.href = "http://pc.xx.com/modules/pay/buyegold.php";
  {?else if $jieqi_thisfile|basename == 'articleinfo.php'?}
  window.location.href = "http://pc.xx.com/book/{?$articleid?}";
  {?else?}
  window.location.href = "http://pc.xx.com/";
  {?/if?}
  }
</script>

2.目录页和章节页和pc差不多相同,一样的逻辑,就是目录页面的细节不一样。文章源自主机测评-https://www.zjcp.org/14190.html

<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(/ Phone/i)
    ){
  }else{
  {?if $jieqi_thisfile|basename == 'reader.php'?}
  window.location.href = "http://pc.xx.com/index/{?$articleid?}";
  {?else if $chapterid != ''?}
  window.location.href = "http://pc.xx.com/book/{?$articleid?}/{?$chapterid?}.html";
  {?else?}
  window.location.href = "http://pc.xx.com/";
  {?/if?}
  }
</script>

杰奇后台伪静态的设置,没写的自己按照格式写伪静态规则,或者不填。文章源自主机测评-https://www.zjcp.org/14190.html

小说信息页面伪静态规则:/book/<{$id}>文章源自主机测评-https://www.zjcp.org/14190.html

小说分类页面伪静态规则:/sort/<{$sortid}>/<{$page}>.html文章源自主机测评-https://www.zjcp.org/14190.html

排行榜页面伪静态规则:/top/<{$order}>/<{$page}>.html文章源自主机测评-https://www.zjcp.org/14190.html

书库伪静态规则:/book_<{$order}>_<{$rgroup}>_<{$sortid}>_<{$typeid}>_<{$words}>_<{$update}>_<{$initial}>_<{$isfull}>_<{$isvip}>_<{$page}>.html文章源自主机测评-https://www.zjcp.org/14190.html

小说目录页伪静态规则:/index/<{$aid}>文章源自主机测评-https://www.zjcp.org/14190.html

小说章节页伪静态规则:/book/<{$aid}>/<{$cid}>.html文章源自主机测评-https://www.zjcp.org/14190.html

搜索结果页伪静态规则:/search/<{$searchtype}>/<{$searchkey}>/<{$page}>.html文章源自主机测评-https://www.zjcp.org/14190.html

搜索结果页伪静态规则:/reviews/<{$aid}>/<{$page}>.html文章源自主机测评-https://www.zjcp.org/14190.html

标签列表页伪静态规则:/taglist/<{$sort}>/<{$page}>.html文章源自主机测评-https://www.zjcp.org/14190.html

apache伪静态,在根目录创建.htaccess文章源自主机测评-https://www.zjcp.org/14190.html

RewriteEngine on文章源自主机测评-https://www.zjcp.org/14190.html

RewriteCond %{REQUEST_FILENAME} !-d文章源自主机测评-https://www.zjcp.org/14190.html

RewriteCond %{REQUEST_FILENAME} !-f文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^templates/(.*).html$ /404.php文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^themes/(.*)/(.*).html$ /404.php文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^modules/(.*)/templates/$ /404.php文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^modules/(.*)/templates/(.*).html$ /404.php文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^book/([0-9]+)$ /modules/article/articleinfo.php?id=$1文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^index/([0-9]+)$ /modules/article/reader.php?aid=$1文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^book/([0-9]+)/([0-9]+).html$ /modules/article/reader.php?aid=$1&cid=$2文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^vip/([a-zA-Z0-9]+)/([0-9]+).html$ /modules/obook/reader.php?aid=$1&cid=$2文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^sort/([0-9]+)/([0-9]+).html$ /modules/article/articlelist.php?sortid=$1&page=$1文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^buyvip/([0-9]+).html$ /modules/obook/buychapter.php?cid=$1文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^books$ /modules/article/articlefilter.php文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^top/([a-z]+)/([0-9]+).html$ /modules/article/toplist.php?order=$1&page=$2文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^search/([0-9]+)/(.*)/([0-9]+).html$ /modules/article/search.php?searchtype=$1&searchkey=$2&page=$3文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^taglist/([0-9]+)/(.*).html$  /modules/article/taglist.php?sort=$1&page=$2文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^book_([a-z]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([a-zA-Z0-9]+)_([0-9]+)_([0-9]+)_([0-9]+).html$ /modules/article/articlefilter.php?order=$1&rgroup=$2&sortid=$3&typeid=$4&words=$5&update=$6&initial=$7&isfull=$8&isvip=$9&page=$10文章源自主机测评-https://www.zjcp.org/14190.html

 文章源自主机测评-https://www.zjcp.org/14190.html

nginx伪静态,需要自己填入配置文件:文章源自主机测评-https://www.zjcp.org/14190.html

if (!-d $request_filename){文章源自主机测评-https://www.zjcp.org/14190.html

set $rule_0 1$rule_0;文章源自主机测评-https://www.zjcp.org/14190.html

}文章源自主机测评-https://www.zjcp.org/14190.html

if (!-f $request_filename){文章源自主机测评-https://www.zjcp.org/14190.html

set $rule_0 2$rule_0;文章源自主机测评-https://www.zjcp.org/14190.html

}文章源自主机测评-https://www.zjcp.org/14190.html

if ($rule_0 = “21”){文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/templates/(.*).html$ /404.php;文章源自主机测评-https://www.zjcp.org/14190.html

}文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/themes/(.*)/(.*).html$ /404.php;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/modules/(.*)/templates/$ /404.php;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/modules/(.*)/templates/(.*).html$ /404.php;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/book/([0-9]+)$ /modules/article/articleinfo.php?id=$1;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/index/([0-9]+)$ /modules/article/reader.php?aid=$1;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/book/([0-9]+)/([0-9]+).html$ /modules/article/reader.php?aid=$1&cid=$2;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/vip/([a-zA-Z0-9]+)/([0-9]+).html$ /modules/obook/reader.php?aid=$1&cid=$2;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/sort/([0-9]+)/([0-9]+).html$ /modules/article/articlelist.php?sortid=$1&page=$1;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/buyvip/([0-9]+).html$ /modules/obook/buychapter.php?cid=$1;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/books$ /modules/article/articlefilter.php;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/top/([a-z]+)/([0-9]+).html$ /modules/article/toplist.php?order=$1&page=$2;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/search/([0-9]+)/(.*)/([0-9]+).html$ /modules/article/search.php?searchtype=$1&searchkey=$2&page=$3;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/taglist/([0-9]+)/(.*).html$ /;文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/book_([a-z]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([a-zA-Z0-9]+)_([0-9]+)_([0-9]+)_([0-9]+).html$ /modules/article/articlefilter.php?order=$1&rgroup=$2&sortid=$3&typeid=$4&words=$5&update=$6&initial=$7&isfull=$8&isvip=$9&page=$10;文章源自主机测评-https://www.zjcp.org/14190.html

 文章源自主机测评-https://www.zjcp.org/14190.html

2019/06/13补充:文章源自主机测评-https://www.zjcp.org/14190.html

杰奇2.4的wap端目录采用的是分页模式,并且还拥有正序倒序的功能,所以如果按照电脑的写法,将会导致无法翻页,正确的配置文件应该是将目录页的伪静态改为如下。文章源自主机测评-https://www.zjcp.org/14190.html

‘fakearticle’ => ‘/index/<{$aid}>/<{$page}>/<{$order}>’,文章源自主机测评-https://www.zjcp.org/14190.html

 文章源自主机测评-https://www.zjcp.org/14190.html

nginx的目录伪静态改为:文章源自主机测评-https://www.zjcp.org/14190.html

rewrite ^/index/([0-9]+)/([0-9]+)/([a-z]+)$ /modules/article/reader.php?aid=$1&page=$2&order=$3;文章源自主机测评-https://www.zjcp.org/14190.html

 文章源自主机测评-https://www.zjcp.org/14190.html

apache的目录伪静态改为:文章源自主机测评-https://www.zjcp.org/14190.html

RewriteRule ^index/([0-9]+)/([0-9]+)/([a-z]+)$ /modules/article/reader.php?aid=$1&page=$2&order=$3;文章源自主机测评-https://www.zjcp.org/14190.html

  • 本文由 发表于 2020年12月28日
  • 转载请务必保留本文链接:https://www.zjcp.org/14190.html

发表评论