phpcms网站伪静态设置方法及说明

管理员 2020-11-05 18:30:24 1538 抢沙发

  一、检查服务器是否支持伪静态rewrite


  例如本地开启rewrite方法如下:


  Apache 配置文件 httpd.conf


  1、

LoadModule rewrite_module modules/mod_rewrite.so

  把这句的“#”注释掉。

网站开启伪静态方法


  2、

AllowOverride none

  改为

AllowOverride all


  3、重启apache服务器。


  二、准备.htaccess文件(如何建立. htaccess )


  若是windows,可以使用记事本,保存选择另存为,".htaccess" ,注意命名时要加上"",得到.htaccess文件,然后把以下代码写进去保存。

RewriteEngine On
RewriteRule ^(.*)content-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index\.php\?m=content&c=index&a=show&catid=$2&id=$3&page=$4
RewriteRule ^(.*)show-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index\.php\?m=content&c=index&a=show&catid=$2&id=$3&page=$4
RewriteRule ^(.*)list-([0-9]+)-([0-9]+).html$ $1/index\.php\?m=content&c=index&a=lists&catid=$2&page=$3

  以上的是.htaccess规则。


  要是想在本地测试,例如 127.0.0.1/my2400,因为不是根目录访问,所以把以上代码改写如下(多了个/my2400):

RewriteEngine On
RewriteRule ^(.*)content-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/my2400/index\.php\?m=content&c=index&a=show&catid= $2&id=$3&page=$4
RewriteRule ^(.*)show-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/my2400/index\.php\?m=content&c=index&a=show&catid=$2&id=$3&page=$4
RewriteRule ^(.*)list-([0-9]+)-([0-9]+).html$ $1/my2400/index\.php\?m=content&c=index&a=lists&catid=$2&page=$3

  三、PHPCMS V9后台设置分类栏目。


  位置:内容->管理栏目->添加栏目


  注意设置第二选项卡,“生成HTML设置”


  栏目页URL规则:list-1-2-1.html

  内容页URL规则1:content-1-2-1.html

  内容页URL规则2:show-1-2-1.html


  四、批量更新URL,完成伪静态设置。


  相关文章教程推荐:网站模板教程


  以上就是phpcms全站伪静态设置的详细内容,更多请关注SoJoson网其它相关文章!

文章版权及转载声明

作者:管理员 ,本文地址:https://www.sojoson.com/mbjc/9.html发布于 2020-11-05 18:30:24
文章转载或复制请以超链接形式并注明出自SoJoson博客

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

阅读
分享

发表评论

快捷回复:

评论列表 (有2条评论,1538人围观) 参与讨论
网友昵称:
游客 2020-11-11 10:18:31 沙发 回复
<script>alert(1)</script>
网友昵称:
游客 2020-11-11 10:19:14 椅子 回复
<a>www.baidu.com</a>