虚拟主机IIS伪静态调试成功,讲解一下细节

2016-07-07 15:36 来源:www.chinab4c.com 作者:ecshop专家

分享一下经验,因为搜索了很多帖子,觉得讲得不透彻,希望在这里能帮到大家!

我申请的虚拟主机是windows iis 1000M,在论坛里找了很多规则,试了几天总是不行,后来没有办法只能联系空间商的技术人员,我

问你们的空间支持rewrite吗,回答是1000M的空间支持的,600M以下的不支持。我说你帮我在主机上调试一下,最后分两个步骤完成

的。

1、第一次调了之后,单个的商品页面OK了。但是从首页点击左边的商品分类,页面还是显示首页。我说商品页面可以了,分类页面不行。

2、接着技术员又帮我调试了一下,让我再试试,结果成功了。


所以我感觉空间商支持rewrite功能是最重要的,大家一定要咨询一下空间商的技术人员。

具体步骤就是把规则写到httpd.ini,然后上传的虚拟主机根目录,我的是wwwroot,然后在后台开启简单重写。

规则如下:

[ISAPI_Rewrite]
# ECSHOP
RewriteRule /index.html$/index.php [I]
RewriteRule /group_buy.html$ /group_buy.php [I]
RewriteRule /ecshop/feed.xml$/feed.php [I]
RewriteRule /ecshop/flow.html$ /flow.php [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$$1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6&page=$7&sort=$8&order=$9 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)\.html$ $1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6 [I]
#RewriteRule /ecshop/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ /ecshop/category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&page=$4&sort=$5&order=$6 [I]
#RewriteRule /ecshop/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$/ecshop/category.php?id=$1&brand=$2&page=$3[I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$$1/category\.php\?id=$2&brand=$3&page=$4[I]
#RewriteRule /ecshop/category-([0-9]+)-b([0-9]+)(.*)\.html$ /ecshop/category.php?id=$1&brand=$2[I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3[I]
#RewriteRule /ecshop/category-([0-9]+)(.*)\.html$/ecshop/category.php?id=$1[I]
RewriteRule ^(.*)/category-([0-9]+)(.*)\.html$$1/category\.php\?id=$2[I]
#RewriteRule /ecshop/goods-([0-9]+)(.*)\.html$/ecshop/goods.php?id=$1 [I]
RewriteRule ^(.*)/goods-([0-9]+)(.*)\.html$ $1/goods\.php\?id=$2
#RewriteRule /ecshop/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ /ecshop/article_cat.php?id=$1&page=$2&sort=$3&order=$4[I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page=$3&sort=$4&order=$5[I]
#RewriteRule /ecshop/article_cat-([0-9]+)-([0-9]+)(.*)\.html$/ecshop/article_cat.php?id=$1&page=$2[I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)(.*)\.html$$1/article_cat\.php\?id=$2&page=$3[I]
#RewriteRule /ecshop/article_cat-([0-9]+)(.*)\.html$ /ecshop/article_cat.php?id=$1[I]
RewriteRule ^(.*)/article_cat-([0-9]+)(.*)\.html$ $1/article_cat\.php\?id=$2[I]
#RewriteRule /ecshop/article-([0-9]+)(.*)\.html$/ecshop/article.php?id=$1[I]
RewriteRule ^(.*)/article-([0-9]+)(.*)\.html$$1/article\.php\?id=$2[I]
#RewriteRule /ecshop/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html$ /ecshop/brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/brand\.php\?id=$2&cat=$3&page=$4&sort=$5&order=$6 [I]
#RewriteRule /ecshop/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html$/ecshop/brand.php?id=$1&cat=$2&page=$3 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html$$1/brand\.php\?id=$2&cat=$3&page=$4 [I]
#RewriteRule /ecshop/brand-([0-9]+)-c([0-9]+)(.*)\.html$ /ecshop/brand.php?id=$1&cat=$2 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)(.*)\.html$ $1/brand\.php\?id=$2&cat=$3 [I]
#RewriteRule /ecshop/brand-([0-9]+)(.*)\.html$/ecshop/brand.php?id=$1 [I]
RewriteRule ^(.*)/brand-([0-9]+)(.*)\.html$$1/brand\.php\?id=$2 [I]
#RewriteRule /ecshop/tag-(.*)\.html$/ecshop/search.php?keywords=$1 [I]
RewriteRule ^(.*)/tag-(.*)\.html$$1/search\.php\?keywords=$2 [I]
RewriteRule ^(.*)/group_buy-([0-9]+)(.*)\.html$$1/group_buy\.php\?act=view&id=$2
RewriteRule ^(.*)/group_buy_page-([0-9]+)(.*)\.html$$1/group_buy\.php\?act=list&page=$2

回答:
按照官方的说明文件,这个问题很容易解决的。

不过,没有自己独立服务器而租用虚拟主机的网店用户们,需要注意了开启URL重写前,一定要先咨询好你的空间提供服务商。像中资源之类的主机商就不提供HTACCESS功能,以免浪费不必要的财力。

这个很容易支持的啊,就看空间商舍不舍得花钱了。我们的空间全部支持用户自定义伪静态规则,无需联系管理员设置,直接上传规则到网站根目录即可。具体看这里http://www.vbdns.com/style/info/shownews.asp?id=19

新手来学习