• 设为首页
  • 收藏本站
  • 积分充值
  • VIP赞助
  • 手机版
  • 微博
  • 微信
    微信公众号 添加方式:
    1:搜索微信号(888888
    2:扫描左侧二维码
  • 快捷导航
    福建二哥 门户 查看主题

    PHPCMS手机站伪静态设置详细教程

    发布者: 山止川行 | 发布时间: 2025-7-24 16:02| 查看数: 67| 评论数: 0|帖子模式

    1、打开/phpcms/modules/wap/functions/global.func.php
    找到里面的这两个函数,如下图所示的注释掉的那行代码,在下面加入一行代码。
    ?
    123456789101112131415161718function 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行,如下图所示的注释掉的那行代码,在下面加入一行代码。
    ?
    12#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  
    ?
    123RewriteRule ^list-([0-9]+)-([0-9]+) index.php?&a=lists&typeid=$1&page=$2RewriteRule ^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服务器,重写规则这样写:
    ?
    12rewrite ^/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手机站伪静态设置),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
    原文链接:http://blog.csdn.net/szk2021/article/details/54890129

    来源:互联网
    免责声明:如果侵犯了您的权益,请联系站长(1277306191@qq.com),我们会及时删除侵权内容,谢谢合作!

    最新评论

    QQ Archiver 手机版 小黑屋 福建二哥 ( 闽ICP备2022004717号|闽公网安备35052402000345号 )

    Powered by Discuz! X3.5 © 2001-2023

    快速回复 返回顶部 返回列表