页首Html代码

帝国cms的tags页面url伪静态的设置

帝国cms的tags页面url默认是 /e/tags/index.php?tagname=XXX

这种形式的,我们希望的是后缀变成

http://www.lingganzuowen.com/tags-etagid17-0.html(其中后面的0是页数,前面的id就是tags的id)

其中这种形式的

那么如何来设置呢?

如图所示:

说明:采用静态页面时不需要设置,只有当采用动态页面时可通过设置伪静态来提高SEO优化,如果不启用请留空。注意:伪静态会增加服务器负担,修改伪静态格式后你需要修改服务器的 Rewrite 规则设置。

.htaccess文件内容:(这里我测试机上用的是apche,如果别的环境请自行转换)

<ifmodule mod_rewrite.c>
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
</ifmodule>

  nginx的规则如下:

rewrite ^/tags-(.+?)-([0-9]+).html$ /e/tags/index.php?tagname=$1&page=$2 last;

 

posted @ 2020-05-11 08:13  开窍  阅读(1940)  评论(0编辑  收藏  举报
页脚Html代码