# IsapiRewrite4.ini
#
# ini file for the ISAPI rewriter. 
# 
# Patterns with exclusion.
# 
# Fri, 30 Jun 2006  09:50
#

RewriteLogLevel 3

#******************************************************************
# Introduction
#
# This ini file illustrates the use of character exclusion in the regular
# expression.  The pattern like [^xxx] says, match any character not
# included in the set, xxx, where xxx is a set of characters.  That set
# can be explicitly defined, or defined by character classes.
#
# There are some predefined character classes in the regular expression
# Syntax supported by PCRE (which is the regular expression engine used by
# IIRF):
# 
# . the dot matches any character except the newline by default
# \d which is equivalent to [0-9]
# \D which is equivalent to [^0-9]
# \w represents "word characters" (digits, underscore and letters)
# \W represents "non word characters"
# \s contains whitespace characters like space, tab, newline, carriage return
# \S contains non-whitespace characters



#******************************************************************
# Rule 1

# This rule matches a simple top-level URLs that has NO digits (top level
# is guaranteed by the exclusion of the slash).  It rewrites it to an
# index.php URL, which places the captured digits into a query parameter.
# The [L] flag says, "apply no more patterns" if a successful match
# occurs.

RewriteRule ^/([^\d\/]+).htm$  /index.php?id=$1  [L]



#******************************************************************
# Rule 2

# This rule matches only simple top-level URLs that end in .htm. 
# Any URL that includes more than one dot or slash, will not match.
# Any URL that does not end in .htm, will not match. 
#
# The rule rewrites the incoming URL to an ASPX page. 
#

#---------------------------------------------
#                $1          
#---------------------------------------------
RewriteRule ^/([^\.\/]+).htm$  /$1.aspx  [L]



#******************************************************************
# Rule 3

# This rule matches only URLs that are one-level deep, and end in .cfm.
# Any URL that is top level, or more than one level deep, will not match.
# NB: According to this rule, the directory name may not contain a dot !
# Any URL that does not end in .cfm, will not match. 
#
# a URL that matches will be rewritten to an ASPX page.


#---------------------------------------------
#                $1          $2
#---------------------------------------------
RewriteRule ^/([^\.\/]+)/([^\.\/]+).cfm$  /$1/$2.aspx  [L]




#******************************************************************
# Rule 4

# This rule matches any URL that uses character escaping in the 
# directory or path segments, but not necessarily a URL that uses
# character escaping in the filename.
#
# See http://www.codeplex.com/IIRF/Thread/View.aspx?ThreadId=10812
#
# On a match, this rule rewrites the URL to a DontUseEscaping.aspx page.
#

RewriteRule ^/(.*%\d+.*)/([^\/]+) /PleaseDontUseEscapeSequencesInDirectoryNames.aspx?path=$1&file=$2    [L]





#******************************************************************





# Given the above rules, here are some sample expected results:
#  input URL                   action       Output URL            Rule #
#--------------------------------------------------------------------------
# /foo.htm                     REWRITE      /index.php?id=foo       1
# /Index.html                  NO ACTION
# /93838.htm                   REWRITE      /93838.aspx             2
# /Cloud9.htm                  REWRITE      /Cloud9.aspx            2
# /options/Index.htm           NO ACTION
# /options/Index.cfm           REWRITE      /options/Index.aspx     3
# /options/Index.jsp           NO ACTION
# /Catalog.cfm                 NO ACTION
# /Dir.Dots/Catalog.cfm        NO ACTION
# /NoDots/Catalog.cfm          REWRITE      /NoDots/Catalog.aspx    3
# /NoEscaping/File1.doc        NO ACTION
# /Home%25Directory/File2.doc  REWRITE      /PleaseDontUse...       4

Last edited May 30, 2008 at 10:45 PM by Cheeso, version 1

Comments

ishakir77 Aug 16, 2010 at 7:25 AM 
what if my url contains /../ in it. then wht to do?
how can i represent these /../ in urlrewrie rule