今天测试帝国ECMS的伪静态化功能,使用的AMP组件式DEDEAMPZ,发现没有开启伪静态功能。在Apache程序目录下的conf目录,找到httpd.conf,LoadModule rewrite_module modules/mod_rewrite.so已经默认加载。所以如果在Apache配置帝国的伪静态规则,应该是可以伪静态化的。但现在我要用.htaccess文件来实现伪静态化。
在httpd.conf中找到
<Directory />
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
修改为:
<Directory />
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
测试!成功了!成功了,You Did IT!Yeah!
注意红色部分,否则开启伪静态后,帝国ECMS将提示没有权限访问,连后台也访问不了。
附帝国ECMS v7的伪静态规则,可直接贴到.htaccess中。
# BEGIN ECMS
RewriteEngine On
#信息内容页:showinfo-[!--classid--]-[!--id--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^showinfo-(.+?)-(.+?)-(.+?)\.html$ /e/action/ShowInfo.php?classid=$1&id=$2&page=$3
#信息列表:listinfo-[!--classid--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^listinfo-(.+?)-(.+?)\.html$ /e/action/ListInfo/index.php?classid=$1&page=$2
#标题分类列表页:infotype-[!--ttid--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^infotype-(.+?)-(.+?)\.html$ /e/action/InfoType/index.php?ttid=$1&page=$2
#TAGS信息列表页:tags-[!--tagname--]-[!--page--].html
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^tags-(.+?)-(.+?)\.html$ /e/tags/index.php?tagname=$1&page=$2
# END ECMS