阿里云服务器

学过seo的朋友都应该知道,动态的url链接对搜索引擎排名非常不利,下面介绍一下帝国cms网站如何设置url伪静态。

1.栏目设置为动态访问

修改单个栏目属性,如下图

帝国教程cms网站

批量修改栏目属性,如下图:

栏目属性

2.网站首页伪静态设置

首页动态设置

3.网站伪静态参数的设置

网站伪静态参数设置

4.网站信息页地址更新

网站信息更新地址

设置好url打开是404,因为没有设置服务器伪静态规则

如果服务器是装的宝塔控制面板只需要后台一键设置就可以了,如下图所示:

帝国伪静态设置


规则如下:

Nginx伪静态规则:

location / {

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;

}

}

修改完配置文件,需要重启nginx生效。

Apache伪静态规则

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


相关阅读: