当前位置: 帮助文档 > > 正文

伪静态规则


五指CMS伪静态规则配置

apache htaccess 伪静态规则配置

首先,服务器需要支持伪静态,保存下面文件到www目录
文件名:

.htaccess

  1. RewriteEngine on
  2. RewriteRule ^item-([0-9]+)-([0-9]+)-([0-9]+).html index.php?v=show&cid=$1&id=$2&page=$3
  3. RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?v=show&cid=$1&id=$2&page=$3
  4. RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?v=listing&cid=$1&page=$2
  5. RewriteRule ^tuan/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html index.php?f=tuan&v=init&cid=$1&price=$2&order=$3&page=$4

放置成功后,无需重启,即可生效。
如果是在apache配置文件中配置伪静态规则的话,那就必须重启apache。

Apache 服务器端配置伪静态

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteCond %{QUERY_STRING} ^(.*)$
  4. RewriteRule ^(.*)/list-([0-9]+)-([0-9]+)\.html$ $1/index.php?v=listing&cid=$2&page=$3&%1
  5. RewriteCond %{QUERY_STRING} ^(.*)$
  6. RewriteRule ^(.*)/item-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?v=show&cid=$2&id=$3&page=$3&%1
  7. RewriteCond %{QUERY_STRING} ^(.*)$
  8. RewriteRule ^(.*)/show-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?v=show&cid=$2&id=$3&page=$3&%1
  9. RewriteCond %{QUERY_STRING} ^(.*)$
  10. RewriteRule ^(.*)/tuan/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index.php?f=tuan&v=init&cid=$2&price=$3&order=$4&page=$5&%1
  11. </IfModule>

Nginx 伪静态规则配置

  1. rewrite ^(.*)/item-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index.php?v=show&cid=$2&id=$3&page=$4 last;
  2. rewrite ^(.*)/show-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index.php?v=show&cid=$2&id=$3&page=$4 last;
  3. rewrite ^(.*)/list-([0-9]+)-([0-9]+).html$ $1/index.php?v=listing&cid=$2&page=$3 last;
  4. rewrite ^(.*)/tuan/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index.php?f=tuan&v=init&cid=$2&price=$3&order=$4&page=$5 last;