Wishlist 0 ¥0.00

windows2008R2下iis7.5中的url重写(urlrewrite)

以前在windows2003里,使用的是iis6.0,那时常使用的URL重写组件是iisrewrite,当服务器升级到windows2008R2时,IIS成了64位的7.5,结果iisreite组件是32位的,虽然可以设置IIS支持32位程序,不过还是希望找个更好的方法,于是找到了:用于 IIS 7 (x64) 的 Microsoft URL 重写模块 2.0 ,下载地址:http://www.microsoft.com/zh-cn/download/details.aspx?id=7435

下载后,双击安装,安装完成后,可以在IIS网站管理中,找到新增加的Url重写这个按钮,见下图:

然后,可以双击“URL重写”按钮,通过“导入规则”htacess文件,可以批量添加规则。这么操作虽然直观,其实最终IIS会在你的网站根目录下生成一个web.config文件。一般内容如下:

 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="已导入的规则 1">
                    <match url="^t-(\d+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/company/third.asp?thirdid={R:1}" />
                </rule>
                <rule name="已导入的规则 2">
                    <match url="^s-(\d+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/productshow/smalllist.asp?sortid={R:1}" />
                </rule>
                <rule name="已导入的规则 3">
                    <match url="^list-(\d+)$" ignoreCase="false" />
                    <action type="Rewrite" url="/productshow/list.asp?typeid={R:1}" />
                </rule>  
            </rules>
        </rewrite>
        <httpErrors errorMode="DetailedLocalOnly" />
        <defaultDocument>
            <files>
                <clear />
                <add value="Default.htm" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="Default.asp" />
                <add value="index.asp" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>

 

 

所以直接修改web.config,在标记段rules里面添加你的转发规则就好了。

About Us

Since 1996, our company has been focusing on domain name registration, web hosting, server hosting, website construction, e-commerce and other Internet services, and constantly practicing the concept of "providing enterprise-level solutions and providing personalized service support". As a Dell Authorized Solution Provider, we also provide hardware product solutions associated with the company's services.
 

Contact Us

Address: No. 2, Jingwu Road, Zhengzhou City, Henan Province

Phone: 0086-371-63520088 

QQ:76257322

Website: 800188.com

E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.