帝国cms Apache、Nginx、IIS伪静态设置方法

帝国cms伪静态设置方法,共分三种情况:Apache、Nginx、IIS,不同web环境下的设置规则是不一样的。

(1)Apache环境下帝国cms伪静态设置方法

在网站根目录下新建或添加.htaccess文件,并写入如下规则代码

RewriteEngine On
ErrorDocument 404 /404.html
Rewritebase /
#信息列表
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^listinfo-(.+?)-(.+?).html$ /e/action/ListInfo/index.php?classid=$1&page=$2
#信息内容页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^showinfo-(.+?)-(.+?)-(.+?).html$ /e/action/ShowInfo.php?classid=$1&id=$2&page=$3
#标题分类列表页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^infotype-(.+?)-(.+?).html$ /e/action/InfoType/index.php?ttid=$1&page=$2
#TAGS信息列表页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^tags-(.+?)-(.+?).html$ /e/tags/index.php?tagname=$1&page=$2
#评论列表页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^comment-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)-(.+?).html$  /e/pl/index.php?doaction=$1&classid=$2&id=$3&page=$4&myorder=$5&tempid=$6

(1)Nginx环境下帝国cms伪静态设置方法

与Apache同为linux下的不同web环境,其伪静态设置方法与Apache类似,均为在网站根目录下新建或添加.htaccess,规则代码基本类似,Nginx环境下帝国cms伪静态设置规则代码如下:

rewrite ^([^.]*)/listinfo-([0-9]+)-([0-9]+).html$ $1/e/action/ListInfo/index.php?classid=$2&page=$3 last;
rewrite ^([^.]*)/showinfo-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/e/action/ShowInfo.php?classid=$2&id=$3&page=$4 last;
rewrite ^([^.]*)/infotype-([0-9]+)-([0-9]+).html$ $1/e/action/InfoType/index.php?ttid=$2&page=$3 last;
rewrite ^([^.]*)/tags-(.+?)-([0-9]+).html$ $1/e/tags/index.php?tagname=$2&page=$3 last;
if (!-e $request_filename) {
return 404;
}

(3)IIS环境下帝国cms伪静态设置方法

由于为window系统,与Apache、Nginx所处的linux截然不同,设置方法也不一样,IIS环境下帝国cms伪静态设置为在网站根目录下新建或添加httpd.ini,并写入如下代码:

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RewriteEngine On
RepeatLimit 32
#帝国#
#信息内容页:showinfo-[!--classid--]-[!--id--]-[!--page--].html
RewriteRule ^(.*)/showinfo-(.+?)-(.+?)-(.+?)\.html$ $1/e/action/ShowInfo\.php\?classid=$2&id=$3&page=$4
#信息列表:listinfo-[!--classid--]-[!--page--].html
RewriteRule ^(.*)/listinfo-(.+?)-(.+?)\.html$ $1/e/action/ListInfo/index\.php\?classid=$2&page=$3
#标题分类列表页:infotype-[!--ttid--]-[!--page--].html
RewriteRule ^(.*)/infotype-(.+?)-(.+?)\.html$ $1/e/action/InfoType/index\.php\?ttid=$2&page=$3
#TAGS信息列表页:tags-[!--tagname--]-[!--page--].html
RewriteRule ^(.*)/tags-(.+?)-(.+?)\.html$ $1/e/tags/index\.php\?tagname=$2&page=$3

上述规则写入添加完毕后,需重启服务器!!!