File: D:/bin/iirf/tests/querystring1/IIRF.ini
# IsapiRewrite4.ini
#
# ini file for the ISAPI rewriter.
#
# QueryString tests
# (Examples for David Scott)
#
# Thu, 27 Apr 2006 06:00
#
RewriteLogLevel 3
##
## /nc/index.asp?tree=xx&page=yy&action=add
##
## should rewrite to:
##
## index.asp?division=nc&tree=xx&page=yy&action=add
##
## Example:
##
## /mw/index.asp?action=add&area=5
##
## should rewrite to:
##
## index.asp?division=mw&action=add&area=5
##
##
# handle the case with a query string
#---------------------------------------------
# $1 $2 $3
#---------------------------------------------
RewriteRule ^/([^\.\/]+)/([^\.\/]+)\.asp\?(.*)$ /$2.asp?division=$1&$3
# handle the case with no query string
#----------------------------------------
# $1 $2
#----------------------------------------
RewriteRule ^/([^\.\/]+)/([^\.\/]+)\.asp$ /$2.asp?division=$1
# This example shows a single rule that handles both the "bare"
# URL and the URl with a query string: The (\?(.+))* matches any
# string beginning with ? and then followed by one or more
# characters. The outer pattern matches zero or more times (with
# the *). According to PCRE, the match for the inner pattern is
# stored in $4 and the match for the outer pattern is $3.
#
# If there is no match (in other words, no querystring passed in the
# incoming request) , then the $4 will resolve to nothing - the empty string.
#
# Passing /index.php as a request would give both $4 and $3 as -the empty string-.
# Passing /index.php?arg1=foo would give the outer pattern ($3) as ?arg1=foo, and the
# inner patter, $4, as arg1=foo.
#
# If the incoming request includes no query string, then the $4 in the replacement string
# will resolve to empty, and if you monitor your IIRF log file, you will see a "substring
# out of range" log message. This might look like a problem, but is just
# a report of the correct, expected behavior of IIRF.
#
RewriteRule ^/([^\.\/]+)/([^\.\/]+)\.php(\?(.+))*$ /$2.php?group=$1&$4
#### The following rules do the converse.
#### For this input:
####
#### /index.asp?department=xx&tree=yy&page=zz
####
#### they give this output:
####
#### /xx/index.asp?tree=yy&page=zz
####
##
##RewriteRule ^/([^\.\/]+\.asp)\?department=([^&]+)&tree=([^&]+)&page=([^&]+)$ /$2/$1?tree=$3&page=$4
##RewriteRule ^/([^\.\/]+\.asp)\?department=([^&]+)$ /$2/$1
##
##
##
### handle the case where "department" is not the first arg after the ASP
##RewriteRule ^/([^\.\/]+\.asp)\?(?!department).*$ /FileNotFound.htm