phpcms手机站首页如何设置伪静态?-PHPCMS

资源魔 55 0

phpcms手机站首页若何设置伪动态?

phpcms手机站首页设置伪动态的办法:

一、关上/phpcms/modules/wap/functions/global.func.php

找到外面的这两个函数,以下图所示的正文掉的那行代码,正在上面退出一行代码。

function list_url($typeid) {
  #return WAP_SITEURL."&a=lists&typeid=$typeid";
  return "/list-$typeid".'.html';
}
function show_url($catid, $id, $typeid='') {
global $WAP;
if($typeid=='') {
 $types = getcache('wap_type','wap');
 foreach ($types as $type) {
  if($type['cat']==$catid) {
  $typeid = $type['typeid'];
  break;
  }
 }
} 
  #return WAP_SITEURL."&a=show&catid=$catid&typeid=$typeid&id=$id";
  return "/show-$catid-$typeid-$id-1".'.html';
}

二、关上/phpcms/modules/wap/index.php

找到第59行,以下图所示的正文掉的那行代码,正在上面退出一行代码。

#define('URLRULE', 'index.php?m=wap&c=index&a=lists&typeid={$typeid}~index.php?m=wap&c=index&a=lists&typeid={$typeid}&page={$page}');
define('URLRULE', 'list-{$typeid}.html~list-{$typeid}-{$page}.html');

三、增加伪动态规定

我应用的是apache效劳器,把apache效劳器设置支持.htaccess文件,正在网站根目次创立.htaccess文件,正在外面增加代码:

RewriteEngine On

RewriteRule ^list-([0-9]+)-([0-9]+) index.php?&a=lists&typeid=$1&page=$2
RewriteRule ^list-([0-9]+) index.php?&a=lists&typeid=$1;
RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+) index.php?a=show&catid=$1&typeid=$2&id=$3;

这样,phpcms手机站就变为伪动态了。

.htaccess若何设置以及创立可自行baidu一下,办法都比拟简略,这里就没有细说了。

假如是nginx效劳器,重写规定这样写:

rewrite ^/list-([0-9]+).html /index.php?&a=lists&typeid=$1 last;
rewrite ^/show-([0-9]+)-([0-9]+)-([0-9]+)-1.html /index.php?a=show&catid=$1&typeid=$2&id=$3 last;

保举教程:《phpcms教程》

以上就是phpcms手机站首页若何设置伪动态?的具体内容,更多请存眷资源魔其它相干文章!

标签: 伪静态 phpcms phpcms教程 phpcms技巧 php问题解决

抱歉,评论功能暂时关闭!