phpcms url.class.php,phpcms V9 栏目伪静态时URL规则中{$categorydir}{$catdir}无效的解决方法...

栏目页伪静态(不生成HTML)时,URL规则中{categorydir}{catdir}仍显示为{categorydir}{catdir}解决方法。

第一步:打开phpcms\modules\content\classes\url.class.php;

第二步:将122行

$url = str_replace(array('{$catid}', '{$page}'), array($catid, $page), $urlrule);

替换为

$category_dir = $this->get_categorydir($catid);

$url = str_replace(array('{$catid}', '{$page}','{$catdir}','{$categorydir}'), array($catid, $page,$category['catdir'],$category_dir), $urlrule);

第三步:保存

使用须知:

1.更改前请先备份原文件;官方升级如果升级此文件,需要再次修改;

2.{categorydir}后默认有'/',{catdir}后默认无 '/'

3.案例:

URL示例:guolei/index.html|guolei/list-2.html

URL规则:{catdir}/index.html|{catdir}/list-{$page}.html

伪静态规则:

RewriteRule ^guonei(/|/index.html)index.php?m=content&c=index&a=lists&catid=6

RewriteRule ^guonei/list-([0-9]+).html index.php?m=content&c=index&a=lists&catid=6&page=$1

4.如有不足之处,请在下方回复说明。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值