# IsapiRewrite4.ini
#
# ini file for the ISAPI rewriter. 
# 
# Tests and demonstrations of  modifier flags. 
#
# Tue, 23 May 2006  17:31
#

RewriteLogLevel 3

##-------------------------------------------------------
## R = Redirect (301 or 302)
##-------------------------------------------------------
## 
## /cim
## 
##   should rewrite to: 
## 
## /about/business/index.html#cim 
## 
## NB: a simple rewrite to a URL that contains an anchor point
## will not work.  This is because #anchors are browser-specific
## instructions.  The server knows nothing about them, so
## rewriting the URL, on the server-side, to a new URL with an
## anchor reference (foo.htm#anchor) will result in a 404.  If
## you use the [R] modifier, the server will issue an HTTP 302,
## "Moved Temporarily".  Thisresults in a browser-side redirect.  
## The browser will request the new page and will advance to the 
## anchor point once the full page is received from the server.
## 

# handle anchor points by using [R] modifier
RewriteRule ^/(cim/{0,1}|pom/|erm/)$  /about/business/index.html#$1  [R]

# Regular Expression Note: that {0,1} is a quantifier in the
# regular expression - essentially it applies to the prior atom,
# which in this case is a slash.  So it evaluates to /cim, with
# or without a trailing slash.  Then the pipe characters (|) or
# essentially logical OR statements.  So this regex says, 
#  either /cim (with or without a trailing slash)
#  or /pom/
#  or /erm/


# remote redirects also work
RewriteRule ^/foo$  http://remotehost/Foo      [R]

# This remote redirect uses a 301 code, "Moved Permanently".
RewriteRule ^/Foo$  http://otherhost/foo       [R=301]


##-------------------------------------------------------
# F = Forbidden  (HTTP 403)
##-------------------------------------------------------
RewriteRule ^/Forbidden$  ThisStringIsIgnored    [F]


##-------------------------------------------------------
# NF = Not found  (HTTP 404)
##-------------------------------------------------------
RewriteRule  ^/ThisUrlIsNotFound  ThisStringIsIgnored    [NF]


##-------------------------------------------------------
# L = Last Rule
##-------------------------------------------------------
# One pass only on this URL (because of [L] flag).  /OnePassOnly
# gets rewritten to /cim.  Note there is a rule that *would*
# match /cim but it is never parsed for this URL, because of the
# [L] modifier flag.
RewriteRule  ^/OnePassOnly   /cim    [L]


##-------------------------------------------------------
# I = case-Insensitive matching
##-------------------------------------------------------
# This flag tells the regular-expression pattern matcher to
# match without regard for case.  There is a regular-expression
# syntax supported in PCRE (and thus in IIRF) that supports
# case- insensitive matching in a more finely-grained manner -
# the (?i) and (?-i) fragments. See the IIRF readme for more
# information.  In any case, this modifier flag is also
# supported.  These two rules, combined with the test URLs in
# the sampleUrls.txt file, demonstrate the capability.

RewriteRule  ^/CaseInsensitive(.*)$   /caseless$1    [I]
RewriteRule  ^/CaseSensitive(.*)$   /notcaseless$1    



##-------------------------------------------------------
# [I,L] = case-insensitive and last-modifier
##-------------------------------------------------------
# This example combines the I and L flags. 

RewriteRule  ^/NoCaseChecking(.*)$   /caseINSENSITIVE$1    [I,L]




##-------------------------------------------------------
# [Q] = an unsupported flag
##-------------------------------------------------------
# This example shows what happens when an unsupported modifier flag
# is used. (You will get a warning in the LOG file)

RewriteRule  ^/Unsupported(.*)$   /DoesThisWork$1    [Q]

Last edited Jul 15, 2008 at 8:21 PM by Cheeso, version 2

Comments

No comments yet.