URL重定向

IisUrlRewriter.ini




# The set of rewrite rules in this file is partially for illustration, and
# partially for filtering ad requests.  I also have a hosts file that
# redirects known ad servers to my local machine, as per
# http://www.mvps.org/winhelp2002/hosts.htm . 
#
# This rewrite rule file redirects the ad requests to the local machine, to a
# "filtered.htm" file.  You drop the "filtered.htm"  into c:\inetsrv\wwwroot and
# you can put anything you like into the filtered.htm  file.  It will display for 
# every filtered ad. 

# Wed, 13 Apr 2005  09:54


# 每行前面加#号即为注释




# 如果启用RewriteLog则生成日志文件
# RewriteLog  c:\temp\iirfLog.out
# RewriteLogLevel 3


# MaxMatchCount
#
# Specifies the maximum number of sub-expression matches to
# capture for a single pattern. This specifies the size of the
# array in the C module.  If you have a pattern with more than
# the default number of matches, set this number.
#
# The default is 10. 


MaxMatchCount 20


#Start dznt URL Rewrite settings
    #rewritebase /test/ /default.aspx
    #一般性的配置 例如:http://www/baidu.com/show1_12.html   这样实际的执行路径为http://www/baidu.com/Default2.aspx?id=12
    RewriteRule ^/show1_([0-9]+)\.html$  /Default2.aspx?id=$1
    RewriteRule ^/show2_([0-9]+)\.html$  /Default2.aspx?id=$1
    RewriteRule ^/show3_([0-9]+)_([0-9]+)\.html$  /Default2.aspx?id=$1&id2=$2
    #目录的配置 例如:http://www/baidu.com/123   这样实际的执行路径为http://www/baidu.com/1234/Default2.aspx
    
    RewriteRule ^/123(\/?)$  /1234/Default2.aspx
    RewriteRule ^/news/$  /1234/Default.aspx
RewriteRule ^/(\w+)\/?$  /1234/Default.aspx?name=$1
   
#End dznt URL Rewrite settings




# This is a sample unparsed rule.  Anything that is not
# understood by the INI file grammar is meaningless, and is
# logged but otherwise ignored by Ionic's ISAPI Rewrite Filter (IIRF).


NotParsed  foo bar



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <a href="/news">定向到/1234/Default.aspx页面</a><br /><br />
        <a href="123">123定向到/1234/Default2.aspx页面</a><br /><br />
        <a href="show1_1212.html">aaaa</a><br />
        <br />
        <a href="show2_1212.html">bbbb</a><br />
        <br />
        <a href="show3_111_222.html">cccc</a><br />
        <br />
    </div>
    </form>
</body>
</html>

示例下载:http://download.csdn.net/detail/hope94/5327876

你可能感兴趣的:(URL重定向)