手机版绑定二级域名的伪静态规则方法

来源: https://destoon.cc/ 日期: 2019-03-01 19:53:16 人气: - 评论: 0

经过测试,受不同服务器软件版本、是否绑定二级域名等因素影响,不同服务器对规则的解析存在差异。

以下为各服务器伪静态规则的两种写法,如果第一条写法不生效,试试第二条写法。

通常情况,第一种写法适合不绑定二级域名,第二种写法适合绑定二级域名。

手机版本属于特殊的独立站点,建议有条件的用户尽量绑定二级域名。

Apache

  1. RewriteRule ^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5
复制代码
  1. RewriteRule ^([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ index.php?moduleid=$1&catid=$2&itemid=$3&page=$4
复制代码

Nginx

  1. rewrite ^/(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /$1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5 last;
复制代码
  1. rewrite ^/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /index.php?moduleid=$1&catid=$2&itemid=$3&page=$4 last;
复制代码

IIS6

  1. RewriteRule ^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?moduleid=$2&catid=$3&itemid=$4&page=$5
复制代码
  1. RewriteRule ^([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ index\.php\?moduleid=$1&catid=$2&itemid=$3&page=$4
复制代码

IIS7+

  1. <match url="^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$" />
  2. <action type="Rewrite" url="{R:1}/index.php?moduleid={R:2}&amp;catid={R:3}&amp;itemid={R:4}&amp;page={R:5}"/>
复制代码
  1. <match url="^([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$" />
  2. <action type="Rewrite" url="index.php?moduleid={R:1}&amp;catid={R:2}&amp;itemid={R:3}&amp;page={R:4}"/>
复制代码

Zeus

  1. match URL into $ with ^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$
  2. if matched then 
  3. set URL = $1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5
  4. endif
复制代码
  1. match URL into $ with ^([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$
  2. if matched then 
  3. set URL = index.php?moduleid=$1&catid=$2&itemid=$3&page=$4
  4. endif
复制代码
portant; margin-bottom: 10px !important; background-image: url("http://bbs.destoon.com/static/image/common/tag.gif"); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0px 2px; background-repeat: no-repeat;">手机版 实在不行就再加上
绑定mobile目录~上传.htaccess规则到mobile目录

.htaccess规则
# Destoon B2B Rewrite Rules
Errordocument 404 /404.php
RewriteEngine On
Rewritebase /
RewriteRule ^([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ index.php?moduleid=$1&catid=$2&itemid=$3&page=$4