Examples

These are some basic examples of ini files used with IIRF.

IIRF basics
Redirection - various examples. Browser sends a request to URL#1, server sends a response to the browser to use URL #2.
Rewriting Headers - rewrite server-side headers based on various criteria
Map Based on HTTP_HOST variable
Route Based on Host Name
Case Folding - Replacing strings with downcased or uppercased versions.
Modifier Flags - case insensitive matching, redirect options, and so on. etc.

Examples of Regular Expression Basics
Character Matching - regex character sets like \d, \D, \w, \W, \s, \S.
Negative Lookaheads - match anything URL that does NOT look like (pattern)
Case Insensitive - case-insensitive matching on a subset of the URL
Do Nothing on Match - a rule that does nothing (no rewrite) on match of the pattern.
Capture Query String, if any - returns the query string, or the empty string if no query string is present.

Scenarios
Blacklist by IP and User Agent
Map Requests by Extension - requests for .php scripts go one place, requests for .jps go somewhere else.
Search Engine Friendly URLs
Simplified URLs 1 - simplify the URLs displayed in the browser address bar
Simplified URLs 2 - display "shoppingcart" in the browser's address bar, but run ViewCart.aspx on the server
Exclude some URLs from Rewrite - Shows how to exclude some URLs from later rules, the cascade effect of rules.
Php Blog
Simple - one URL Segment to an ASPX Query Param
Map URL segments to Query params
Allow SharePoint Search to work on http and https URLs
Remove default.aspx from the URL - also, map a URL path segment to a query param for the language
Example for Joomla/SEF

Last edited Jul 24, 2009 at 4:01 PM by Cheeso, version 28

Comments

pranaysharmadelhi Aug 16, 2011 at 4:29 PM 
How can we rewrite a URL like based on a directory? If internal directory is present, it is not rewritten, else it is rewritten to external directory
http://www.abcd.com/internal/Test.aspx => http://www.abcd.com/internal/Test.aspx (NO REWRITING)
http://www.abcd.com/Test.aspx => http://www.abcd.com/external/Test.aspx (REWRITTEN)

rumblpup Jun 8, 2009 at 6:03 AM 
dood - check out the forums. http://iirf.codeplex.com/Thread/List.aspx

rpandhe Feb 14, 2009 at 4:17 AM 
hi there,
how can write a url rule that maps url segments to querystring parameters only if the parameter is not provided already.
e.g. http://www.abcd.com/XXXX/?Listid=1211 ---> http://wwww.abcd.com/XXXX/?store=XXXX&ListID=1211
but http://www.abcd.com/XXXX/?store=XXXX&Listid=1211 should not be rewritten. (Note: store=XXXX can appear anywhere in the querystring)