巫妖天下 - LichSky

关于作者:专注于微软平台项目架构、管理和企业解决方案。熟悉各类技术手段、架构设计、开发和项目管理。现主要从事项目开发、架构、管理工作。

« json for asp笔记本win2003无法无线上网 »

IIS ReWrite

IIS 6,httpd.ini

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32

#带一个参数的
RewriteRule /page/thread-(.*)\.html /page\.asp\?name=$1 

#带一个数字参数的
RewriteRule /news/detail-(\d+)\.html /news/detail\.asp\?id=$1 

#带两个数字的
RewriteRule /news/page-(\d+)-(\d+)\.html /news/index\.asp\?class_id=$1&nid=$2



------------
IIS7/8,web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ImportedRule1" stopProcessing="true">
                    <match url="^page/thread-(.*).html" />
                    <action type="Rewrite" url="/page.asp?name={R:1}" />
                </rule>
                <rule name="ImportedRule2" stopProcessing="true">
                    <match url="^news/detail-(\d+).html" />
                    <action type="Rewrite" url="/news/detail.asp?id={R:1}" />
                </rule>
                <rule name="ImportedRule3" stopProcessing="true">
                    <match url="^news/page-(\d+)-(\d+).html" />
                    <action type="Rewrite" url="/news/index.asp?class_id={R:1}&nid={R:2}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Walle Build 100427

Copyright 巫妖天下(lichsky@163.com) All Rights Reserved.