IIRF
Ionic's ISAPI Rewrite Filter
Do you want a FREE URL Rewriter for IIS?
Do you wish IIS had a mod_rewrite? Check out IIRF.
IIRF is an ISAPI filter that does URL Rewriting for IIS. It's small,
FREE, and easy to use. It is easy to install, fast, and powerful. You
can get Search-Engine Friendly (SEF) or Search-Engine
Optimized (SEO) URLs easily on IIS 6, 7, or 7+. It works with what
you have, and there's help available to get you going. You can get the
source code to inspect it or even modify it yourself.
Next steps:
Why Rewrite URLs?
Server-side rewriting of URLs means that instead of exposing messy URLs to users and
search engines, you can expose clean ones. A URL like
http://server/catalog/QueryProduct.aspx?product_id=3093092
...is too long, is difficult to type, and includes no helpful
keywords. It's NOT optimize for search engines. With URL rewriting, even
though your e-commerce app expects that kind of URL, you can publicly
expose a clean and friendly URL like
http://server/product/3093092/Waring-Blender
Users are happier, search engines are happier, and you will be happier.
Rewriting URLs on the server-side has been a "best practice" for a long time. It has many advantages:
- you can use pretty URLs ("Search-engine
friendly", "Search Engine Safe" (SES), or "Search-Engine
Optimized" (SEO) URLs), with web application platform
infrastructure that uses or generates ugly URLs. Some web or
portal servers are notorious for generating ugly URLs, but you
don't need to expose them to the world.
- URLs can stay pretty, even if you change the server-side
system (eg, dispatch.fcgi instead of .cgi, or .aspx instead of
.jsp).
- you can migrate or modify sites, without orphaning old links.
- blacklist bots based on user-agent or IP address
- prevent off-site image leeching.
force the use of a secure site (https) for certain URLs.
It's really convenient with ColdFusion, PHP, Ruby, Joomla,
ASP.NET, JSP or any number of other server-side technologies.
Why was IIRF created?
Apache has mod_rewrite, which allows URL rewriting. But IIS
didn't have anything similar as a built-in, or as a "standard" free
add-on.
There are commercial ISAPI
filters that extend IIS with the ability to re-write URLs. But
you have to pay. There are free ones, but they generally don't
offer regular expression matching, or automatic ini file
reloading, or other powerful features.
ASP.NET has a URL mapping mechanism, but it works only for
filetypes that are handled by ASP.NET: aspx, ascx, asmx, and so
on. For static files or non-ASP.NET files, (xml, gif, jpg, css),
the ASP.NET mapping won't work cleanly. If you don't want to install
ASP.NET, then you can't use it.
For IIS7, Microsoft has provided a rewrite module, but it doesn't
work with IIS5 or IIS6.
IIRF is intended to fill the gap: it's an easy to use rewriter, and
works with all current versions of IIS. It's FREE, open source, and it
has regular expression support.
Summary of features of IIRF
- Affordable: there is no fee or cost to use IIRF.
- Simple to install: copy over 2 files, and 2 minutes to configure the filter.
- Simple to configure: put your rewrite rules in a text file, using a simple syntax, similar to Apache mod_rewrite.
- Simple to get started: documentation and example rule sets are included.
- Easy to live with: automatic ini file reloading, without IIS restart. [U] unmangle option enables logging of the original Search-engine friendly URLs in IIS log files, or access to those URLs in the eventual web application.
- Flexible: Rewrite rules are specified using regular expressions
(provided by PCRE).
- Capable: IIRF does Conditional rewrites (via RewriteCond), Redirects (301,
302, etc), Rewriting HTTP Headers, RewriteMap, and Reverse HTTP Proxy. The -f -d
and -s flags for rewriting based on the state of the filesystem. The
QSA modifier appends query strings to the results of any rewrite. You
can do lexicographic comparisons for load distribution in a server farm.
- Scalable: install a single instance of the filter on a server, and then each website or web application gets its own configuration file.
- Easy to adopt: open source, permissive license
- Works with what you have: works with IIS5, IIS6, and IIS7, with web engines like PHP, CGI, JSP, ASP.NET, Coldfusion (CFM), and many others. Works with Joomla, Ruby-on-Rails, Mambo, Tomcat many others. Works with SharePoint, Community Server, and ASP.NET MVC too.
- Easy to understand, audit, or modify: It is implemented in about 3700 lines of commented C code.
- Easy to build: compiles with Microsoft Visual Studio 2005 or 2008 or with the (free) Microsoft VC++ 2005/2008 Express compiler.
All of the features, and how to use them, are described in detail in the help file,
which is available for
download. A web version of that helpfile is also available, at IIRF Help. There doc is clear and well-written and includes many
examples to help you get started.
NB:IIRF does not do forward-proxying or caching.
The IIRF License
Ionic's ISAPI Rewrite Filter (IIRF, referred to as "the software" in the
text below) is an add-on to IIS that can rewrite URLs. IIRF and its
documentation is distributed under the Microsoft Permissive License,
which is spelled out below.
IIRF depends upon PCRE, which is licensed independently and
separately.
Microsoft Permissive License (Ms-PL)
Published: October 12, 2006
This license governs use of the accompanying software. If you
use the software, you accept this license. If you do not accept
the license, do not use the software.
- Definitions
The terms "reproduce," "reproduction," "derivative works," and
"distribution" have the same meaning here as under
U.S. copyright law.
A "contribution" is the original software, or any additions or
changes to the software.
A "contributor" is any person that distributes its contribution
under this license.
"Licensed patents" are a contributor's patent claims that read
directly on its contribution.
- Grant of Rights
(A) Copyright Grant- Subject to the terms of this license,
including the license conditions and limitations in section 3,
each contributor grants you a non-exclusive, worldwide,
royalty-free copyright license to reproduce its contribution,
prepare derivative works of its contribution, and distribute its
contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license,
including the license conditions and limitations in section 3,
each contributor grants you a non-exclusive, worldwide,
royalty-free license under its licensed patents to make, have
made, use, sell, offer for sale, import, and/or otherwise
dispose of its contribution in the software or derivative works
of the contribution in the software.
- Conditions and Limitations
(A) No Trademark License- This license does not grant you rights
to use any contributors' name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over
patents that you claim are infringed by the software, your
patent license from such contributor to the software ends
automatically.
(C) If you distribute any portion of the software, you must
retain all copyright, patent, trademark, and attribution notices
that are present in the software.
(D) If you distribute any portion of the software in source code
form, you may do so only under this license by including a
complete copy of this license with your distribution. If you
distribute any portion of the software in compiled or object
code form, you may only do so under a license that complies with
this license.
(E) The software is licensed "as-is." You bear the risk of using
it. The contributors give no express warranties, guarantees or
conditions. You may have additional consumer rights under your
local laws which this license cannot change. To the extent
permitted under your local laws, the contributors exclude the
implied warranties of merchantability, fitness for a particular
purpose and non-infringement.
Release history
| Version | Release Date | Features |
| v1.0 | 2005 January |
| v1.0.1 | 2005 July |
| v1.1 | 2005 September |
| v1.2 | 2006 February |
| v1.2.2 | 2006 April | bugfix+testing |
| v1.2.3 | 2006 May | more bugfixes+testing |
| v1.2.4 | 2006 May | added redirection |
| v1.2.9 | 2006 July | Added modifier flags like U, R, L, I, F, NF |
| v1.2.10 | 2006 Sept | special patterns: -d, -f, -s; chaining RewriteCond |
| v1.2.11 | 2007 Feb | new filter priority, new flow logic |
| v1.2.12 | 2007 June | improved memory handling |
| v1.2.14 | 2008 June | bugfixes, reliability work |
| v1.2.15 | 2008 October | RewriteHeader, RedirectRule |
| v1.2.16 | 2009 July | CHM documentation, QSA modifier, status URL, bug fixes |
| v2.0 | 2009 November | site-specific config, ProxyPass, Included ini files, MSI installer |
| v2.1 (beta) | 2010 April | RewriteMap directive, lexicographic comparisons in RewriteCond |
(click for a printable page)
This page has been accessed
143939
times since 24 April 2006