phpcms伪静态优化
时间:
阅读:112
phpcms伪静态优化
最佳回答
在安装完最新版的PHPCMS V9版后,默认是不启用伪静态的,你需要经过一些设置才能实现。
.htaccess文件
首先第一点,你需要在网站根目录下放置一个“.htaccess”文件,来标明其“Rewrite”规则。这个文件实际在最新版的V9版的readme目录下有,默认跟上传目录分开的,刚才说了,PHPCMS默认是不开启伪静态的。所以,你只需要将其上传到你的根目录即可。当然你也可以自己编写,其内容如下:
RewriteRule ^content-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$1&page=$2
栏目管理设置不生成Html
第二步,你需要在你的后台栏目管理里面,对你的各个栏目设置为不生成Html,默认是生成的,请注意。
同时,你还需要选择栏目页和内容页的URL规则如上图所示的规则类型。
一切设置完毕后,更新你的缓存,就完工了!
最新回答共有2条回答
-
游客
回复linux+apache
文件位置:网站主目录 .htaccess
内容可参考:
<FilesMatch ".(bak|inc|lib|sh|tpl|lbi|dwt)$">
order deny,allow
Allow from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^content-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$1&page=$2
</IfModule>windows+iis
文件位置:网站主目录 web.config
内容可参考:
<?xml version="1.0" encoding="UTF-8"?>
&