学过seo的朋友都应该知道,动态的url链接对搜索引擎排名非常不利,下面介绍一下帝国cms网站如何设置url伪静态。
1.栏目设置为动态访问
修改单个栏目属性,如下图
批量修改栏目属性,如下图:
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} ^(.*)$