热搜词
发表于 2016-2-15 08:47:10 | 显示全部楼层 |阅读模式
  最近在研究CMS时候,首先是使用DEDECMS,后来又转到了PHPCMS,感觉后者架构更加合理,而前者主要是模板众多,故使用者多一些,不过我都是需要自己写模板,那就无所谓了。

  玩各种CMS我喜欢首先看看是否支持伪静态,因为我认为作为建站的初期,访问量一般不会很大,故使用动态页面就足够了,不需要全部网页都静态化,在不断的修改中还得不断的生成查看效果,故还是直接动态方便些,而一般CMS都具备伪静态来实现动态页的静态地址。当然,如果你是做很大的站点,可以不采纳我的这个建议。

  在安装完最新版的PHPCMS V9版后,默认是不启用伪静态的,你需要经过一些设置才能实现。

.htaccess文件
  首先第一点,你需要在网站根目录下放置一个“.htaccess”文件,来标明其“Rewrite”规则。这个文件实际在最新版的V9版的readme目录下有,默认跟上传目录分开的,刚才说了,PHPCMS默认是不开启伪静态的。所以,你只需要将其上传到你的根目录即可。当然你也可以自己编写,其内容如下:
  • 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

[color=rgb(51, 102, 153) !important]复制代码

栏目管理设置不生成Html
  第二步,你需要在你的后台栏目管理里面,对你的各个栏目设置为不生成Html,默认是生成的,请注意。
162829vcdf8rvbdgv2hvio.jpg

  同时,你还需要选择栏目页和内容页的URL规则如上图所示的规则类型。

  一切设置完毕后,更新你的缓存,就完工了!
全部评论1
灰儿 发表于 2016-2-15 08:58:31 | 显示全部楼层
官网下载的的  .htaccess 伪静态文件:

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



互换为IIS7下的web.config文件:

<rewrite>
            <rules>
                <rule name="Imported Rule 1">
                    <match url="^content-([0-9]+)-([0-9]+)-([0-9]+).html" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?m=content&amp;c=index&amp;a=show&amp;catid={R:1}&amp;id={R:2}&amp;page={R:3}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 2">
                    <match url="^show-([0-9]+)-([0-9]+)-([0-9]+).html" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?m=content&amp;c=index&amp;a=show&amp;catid={R:1}&amp;id={R:2}&amp;page={R:3}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 3">
                    <match url="^list-([0-9]+)-([0-9]+).html" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?m=content&amp;c=index&amp;a=lists&amp;catid={R:1}&amp;page={R:2}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>


回复

使用道具 举报

回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|管理员之家 ( 苏ICP备2023053177号-2 )

GMT+8, 2024-10-8 06:41 , Processed in 0.186680 second(s), 29 queries .

Powered by Discuz! X3.5

Cpoyright © 2001-2024 Discuz! Team