当前位置:首页站长学院PHPCMSphpcms手机站首页如何设置伪静态?
企业营销,就选知企PROSAAS

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

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

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

phpcms手机站首页设置伪静态的方法:

1、打开/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';
}

2、打开/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');

3、添加伪静态规则

我使用的是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如何设置和创建可自行百度一下,方法都比较简单,这里就不细说了。

如果是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手机站首页如何设置伪静态?的详细内容,更多请关注知企PROSAAS其它相关文章!

温馨提示:

文章标题:phpcms手机站首页如何设置伪静态?

文章链接:https://ceshi.prosaas.cn/4070.html

更新时间:2020年06月13日

声明: 本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:973664285@qq.com我们将第一时间处理! 资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。 所有资源仅限于参考和学习,版权归原作者所有,更多请阅读知企PROSAAS协议

给TA打赏
共{{data.count}}人
人已打赏
PHPCMS

phpcms的文章来源怎么设置?

2020-6-13 13:57:05

PHPCMS

phpcms更换域名后网站无法访问怎么办?

2020-6-13 14:27:08

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索