IIS下isapi_rewrite full 多站点重写完美解决方案 - 飘凌大杂烩
飘凌大杂烩电脑网络手机数码web服务器IIS下isapi_rewrite full 多站点重写完美解决方案
    
 
IIS下isapi_rewrite full 多站点重写完美解决方案
发起人:piaoling  回复数:0  浏览数:6248  最后更新:2009/9/8 15:25:53 by piaoling

选择查看 搜索更多相关主题  帖子排序:
2009/9/8 15:25:53
piaoling






角  色:管理员
等  级:旅长
发 帖 数:672
经 验 值:2001
注册时间:2008/12/7
IIS下isapi_rewrite full 多站点重写完美解决方案
首先下载一个破解版的或是买一个正式版的(如果你钱多的话,呵呵)

一步步安装好后,设置

1、将下载文件解压安装,安装过程中你可以自己选择安装目录,我是安装在D:\rewrite\ISAPI_Rewrite中
2、安装完成后打开ISAPI_Rewrite目录中ISRWConfig.exe,输入上面的注册码完成注册。
3、设置ISAPI_Rewrite目录权限(以下3-4步骤一般无须设置,默认安装后已经给你设置好了,如果发现不能用再来设置)
权限说明:
Administrators 和 SYSTEM 全部权限
IIS_WPG   读取和运行/读取
进入ISAPI_Rewrite目录,右键ISAPI_Rewrite.dll-属性-安全,加入Everyone的访问"读取"权限。
4、打开IIS管理器,点击左边网站,右键-属性-ISAPI筛选器-然后定位到D:\rewrite\ISAPI_Rewrite\ISAPI_Rewrite.dll确定启用,然后重启IIS生效。


通过上面的安装与设置后,rewrite已经可以使用了,现在来说多站点的配置解决方式

如果你像我一样有多个站点都装了dz,又不想一个站点一个站点的去设置,那就采用全局的方式配置,全局配置方式像lite版的一样,把规则写到安装目录下的httpd.ini文件中,重启一下iis就可以了,但是切记全局规则一定要比较规范严谨,不然就可能造成很多问题,比如说fck用不了啦,一些页面打不开啦等等
我测试过没有问题的规则现在发出来,给大家使用
------------------------------------------------------------------------

# DZ6.0/6.1/7.0论坛+UCHome Rewrite规则,针对可操作IIS用户,
# 此默认规则只针对UCHome程序放在根目录中用独立域名访问的,论坛也可以直接用.
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)\?*(.*)$ $1/archiver/index\.php\?$2&$4
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forumdisplay\.php\?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/viewthread\.php\?tid=$2&extra=page\%3D$4&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/space\.php\?$2=$3&$4
RewriteRule ^(.*)/tag-(.+)\.html\?*(.*)$ $1/tag\.php\?name=$2&$3
#uch放在根目录时的伪静态
RewriteRule ^/(space|network)-(.+)\.html$ /$1\.php\?rewrite=$2 [L]
RewriteRule ^/(space|network)\.html$ /$1\.php [L]
RewriteRule ^/([0-9]+)$ /space\.php\?uid=$1 [L]
#uch放在二级目录时的伪静态
RewriteRule ^/uhome/(space|network)-(.+)\.html$ /uhome/$1\.php\?rewrite=$2 [L]
RewriteRule ^/uhome/(space|network)\.html$ /uhome/$1\.php [L]
RewriteRule ^/uhome/([0-9]+)$ /uhome/space\.php\?uid=$1 [L]

---------------------------------------------------------------------

# Ecshop重写规则
#RewriteRule ^(.*)/index.html    $1/index.php
#RewriteRule ^(.*)/default.html  $1/index.php
# access any object by its numeric identifier
RewriteRule /feed-c([0-9]+)\.xml /feed\.php\?cat=$1
RewriteRule /feed-b([0-9]+)\.xml /feed\.php\?brand=$1
RewriteRule /feed\.xml$                 feed\.php
RewriteRule /category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html /category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8
RewriteRule /category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html /category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5
RewriteRule /category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html /category\.php\?id=$1&brand=$2&page=$3&sort=$4&order=$5
RewriteRule /category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html /category\.php\?id=$1&brand=$2&page=$3
RewriteRule /category-([0-9]+)-b([0-9]+)(.*)\.html /category\.php\?id=$1&brand=$2
RewriteRule /category-([0-9]+)(.*)\.html /category\.php\?id=$1
RewriteRule /goods-([0-9]+)(.*)\.html /goods\.php\?id=$1
RewriteRule /article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html /article_cat\.php\?id=$1&page=$2&sort=$3&order=$4
RewriteRule /article_cat-([0-9]+)-([0-9]+)(.*)\.html /article_cat\.php\?id=$1&page=$2
RewriteRule /article_cat-([0-9]+)(.*)\.html /article_cat\.php\?id=$1
RewriteRule /article-([0-9]+)(.*)\.html /article\.php\?id=$1
RewriteRule /brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html /brand\.php\?id=$1&cat=$2&page=$3&sort=$4&order=$5
RewriteRule /brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html /brand\.php\?id=$1&cat=$2&page=$3
RewriteRule /brand-([0-9]+)-c([0-9]+)(.*)\.html /brand\.php\?id=$1&cat=$2
RewriteRule /brand-([0-9]+)(.*)\.html /brand\.php\?id=$1
RewriteRule /tag-(.*)\.html /search\.php\?keywords=$1
RewriteRule /snatch-([0-9]+)\.html /snatch\.php\?id=$1
RewriteRule /group_buy-([0-9]+)\.html /group_buy\.php\?act=view&id=$1
RewriteRule /auction-([0-9]+)\.html /auction\.php\?act=view&id=$1

--------------------------------------------------------------------


#modoer伪静态规则for1.1
#首页去除首页规则,不然会引起其它子站出错
#RewriteRule ^(.*)/index\.html\?*(.*)$ $1/index\.php [L]
#TAG标签页
RewriteRule ^(.*)/shop/tag\.html\?*(.*)$ $1/shop/tag\.php [L]
RewriteRule ^(.*)/shop/tag_(.+)\.html\?*(.*)$ $1/shop/tag\.php\?tagname=$2 [L]
#商铺大全
RewriteRule ^(.*)/shop/cate_([0-9]+)\.html\?*(.*)$ $1/shop/cate\.php\?cd=$2 [L]
RewriteRule ^(.*)/cate_([0-9]+)_([a-z]+)_([0-9]+)\.html\?*(.*)$ $1/shop/cate\.php\?cd=$2&order=$3&page=$4 [L]
#RewriteRule ^shop/cate_([0-9]+)(\.html|) shop/cate.php?cd=$1
#RewriteRule ^shop/cate_([0-9]+)_([a-z]+)_([0-9]+)(\.html|) shop/cate.php?cd=$1&order=$2&page=$3
#商铺页面
RewriteRule ^(.*)/shop/([0-9]+)\?*(.*)$ $1/shop/shop\.php\?shopid=$2$3 [L]
#RewriteRule ^shop/(shop_|)([0-9]+)(\.html|)$ shop/shop.php?shopid=$2$3
#点评内容页面
RewriteRule ^(.*)/shop/viewreview_([0-9]+)\.html\?*(.*)$ $1/shop/viewreview\.php\?reviewid=$2 [L]
RewriteRule ^(.*)/shop/viewreview_([0-9]+)\.html#respond$\?*(.*)$ $1/shop/viewreview.php?reviewid=$2#respond [L]
#个人空间
RewriteRule ^(.*)/space/([0-9]+)$ $1/space/index\.php\?suid=$2 [L]
RewriteRule ^(.*)/space/([0-9]+)_([a-z]+)\?*(.*)$ $1/space/index\.php\?suid=$2&n=$3 [L]
#兑奖中心
RewriteRule ^(.*)/exchange/gift_([0-9]+)\.html\?*(.*)$ $1/exchange/index\.php\?action=gift&giftid=$2 [L]
#优惠券,这个有问题,不用
#RewriteRule ^(.*)/coupon/([0-9]+)\?*(.*)$ $1/coupon/index\.php\?ac=detail&couponid=$2$3 [L]
#新闻资讯
RewriteRule ^(.*)/article/([0-9]+)\.html\?*(.*)$ $1/article/article\.php\?articleid=$2 [L]
RewriteRule ^(.*)/article/classid_([0-9]+)\.html\?*(.*)$ $1/article/index\.php\?classid=$2 [L]

---------------------------------------------------------------------------
这几个规则我写到了全局里,测试过不会造成其它站点的问题

而ecmall的就会造成其它站点的问题,所以,写到站点规则里

----------------------------------

# Ecmall重写规则
# 为了确保重写规则不影响服务器上的其他站点
# 请将下面的语句前的#号去掉,并将(?:www\.)?site1\.com改为商店所在域名
RewriteCond %{HTTP:Host} (?:mall\.)?ynczw\.net
RewriteRule ^(.*)/index.html$   $1/index.php
RewriteRule ^(.*)/([a-zA-Z0-9]+)_(.*)\.html$ $1/index\.php\?app=$2&arg=$3

----------------------------------

其它的使用要点,刚开始装上以后,全局重写没有任何问题,但站点重写总是失败,后来查了很多文章,总结如下

在需要使用rewrite的站点根目录下创建httpd.ini文件,并且给相应用户的读权限

内容开头一定要有
[ISAPI_Rewrite]

RewriteCond Host: www\.x4hack\.com

其他的根据规则自行写入,切记加亮的部份一定要有,不然站点重写一定会失败
返回页首↑


津ICP备09000164号

联系我们 - piaoling Corporation - 论坛存档 - 返回顶端
Powered by BBSXP 2007 ACCESS © 1998-2025
Server Time 2025/1/13 19:42:18
Processed in 0.02 second(s)
飘凌大杂烩