This topic contains the following sections.
IIRF is Ionic's ISAPI Rewriting Filter, a free and open source rewriting filter for IIS. The source as well as binary packages are available on the IIRF codeplex project page.
What is IIRF?
The mod_rewrite module is widely used with the Apache HTTP Server to rewrite URL requests before they reach web application engines. IIS 5.0 (Windows 2000) 5.1 (Windows XP) and v6.0 (Windows Server 2003) and v7.0 Vista lack a built-in URL rewriting function. (Windows Server 2008 with IIS v7.5 has an add-on URL Rewriting Module available from IIS.NET).
There are several add-on tools that can add the URL re-writing function to IIS. Most are implemented as ISAPI Filters.
- UrlRewriting.Net - an ASP.NET URL Rewriter
- the IIS6 Resource Kit includes the UrlRemap tool.
- ISAPI Rewrite, from Helicon Tech
- Mod_Rewrite 2
- the IIS7 RewriteModule , from Microsoft
All of them have drawbacks.
The UrlRewriting.Net tool is free, and open source. It uses Regular Expressions for pattern matching, which is good. But, it requires ASP.NET, and all URLs run through ASP.NET; even static files would have to be served by the ASP.NET runtime. This can imply a performance cost, and it also may be undesirable in some cases to deploy .NET on web servers. For example, some web administrators want to serve only PHP content, and do not want to install or deploy ASP.NET. Also, it lacks some features, and its configuration file syntax is novel and unfamiliar to users of mod_rewrite.
The IIS6 Resource Kit filter is provided by Microsoft, and is supported. The drawback: it does not allow specifying rules via Regular Expressions , and as a result it is not as flexible as some would like.
Helicon's ISAPI Rewrite module is a commercial offering and is commercially supported, and does use Regular Expressions , but is expensive. There is a "lite" version available for free, but it does not support Regular Expressions. Likewise Mod_Rewrite and IISRewrite.
The IIS7 RewriteModule is a free add-on from Microsoft, and it has some nice GUI tools for setup and administration. But it works only with IIS7.
IIRF adds one more option to the list. IIRF is an open-source Rewrite filter, available in source or binary form at no cost. It does mapping pattern matching based on Regular Expressions , via the open source Perl Compatible Regular Expressions (PCRE) library. The source code for the filter is available so you can analyze or modify the filter if you want to, or need to. As well, the source for the PCRE library is also available, from its maintainers.
Overview of Features and Capabilities
- IIRF can rewrite URLs, to map between the externally-facing URL and the internally-used URL on the server. See the directive.
- IIRF can rewrite request headers. This works in the same way as rewriting the URL. In fact, rewriting the URL is just a special case of rewriting any request header. See the directive.
- IIRF can redirect requests, sending HTTP 301 or 302 response codes.
- New for v2.0, IIRF can act as a transparent (reverse) proxy for selected URLs.
- IIRF can inject HTTP return codes for particular URLs based on a variety of factors.
- IIRF can select which requests to rewrite or redirect, or which headers to rewrite, based on a regular-expression pattern match on the incoming request URL, as well as pattern matching on any server variable, including any request header.
IIRF works on Windows, including Windows 2000 (but you should upgrade), Windows XP, Windows Server 2003, Windows Vista, or Windows Server 2008. It works only with IIS Server, not with other web servers.
IIRF works with any web application logic, including but not limited to: Cold Fusion (CFM), Active Server Pages (ASP), ASP.NET, JSP, PHP, as well as static files like CSS, JPG, HTM, xml, and so on. It works with web applications like Joomla, wordpress, Sharepoint, and others.
Compatibility issues may arise with other ISAPI filters. Let me know if you run into problems.
IIRF is DonationWare!
If you use IIRF, I'd encourage you to donate. IIRF is completely free but if you like it and would like to show your appreciation for the effort I put in, I am accepting donations on behalf of my favorite charity. To donate please visit the donation page. It's easy to donate via Paypal or any credit card, and takes just a moment. Your consideration is appreciated. Any amount will help.