Those lovely people at Ionic have blessed us with a fully working URL rewriter for IIS completely FREE of charge. They also provide release notes, help files and source code!

*Update*

Ladies and Gentlemen, I would like to inform you that this website has just been blessed with – not only a visit from, but a comment by, a man who is so cool – even his own mother knows him only as …Ionic Shade… LOL!

A one man bastion of freedom, a warlord of the open-source world and a pioneer of uber friendly URL’s that gives us all here in blogland some GoogleLuvin’.

This is a ‘live’ tutorial of how to get it installed up and runnin’. When I say a ‘live’ tutorial I mean a real-world dictation of what I’m doing to get it working – there’ll be no spit-n-polish / post edits or glossing over the cracks here!

1st. Visit those lovely people at Mr. Ionic Shade here: http://cheeso.members.winisp.net/IIRF.aspx

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.

It’s a shame their website doesn’t have comments and this is why I’ve written this post because I just wanted to say THANK YOU! We are not worthy!!

The installation:

2nd. Once you’ve downloaded ISAPI Rewrite their latest version being IonicIsapiRewriter-1.2.16-bin.zip as of this post unzip the folder and follow these instructions. I’m running Windows 2003 Server with IIS 6.

Installation is simple, but manual [but think of all the $$$ you’re saving].  You need to install the ISAPI Filter, as with any ISAPI.  Do it through the IIS MMC panel.  Add the filter to the all web sites, or to a particular website.

On IIS6 or IIS5, follow these steps:

1) Copy the filter DLL (IsapiRewrite4.dll) to an appropriate folder, such as c:\windows\system32\inetsrv\IIRF .  Or it could be in a totally separate directory tree.  It’s up to you. The only thing – don’t put it in the web document tree.  (It causes problems with detecting changes in the .ini file.  There’s more about this later.)

Place the settings file (IsapiRewrite4.ini), in the same directory as the DLL file. The filter will look for its settings in that file.

Ok here I went to c:\windws\system32\inetserv and created a directory called IIRF and copied the files IsapiRewrite4.dll and IsapiRewrite4.ini into it.

2) Grant READ permissions on the DLL and the .ini file and the containing directory to the appropriate Windows principal (IUSR_hostname).  On Windows Server, also grant Read permissions to the IIS_WPG group for all these things.

Ok, here I selected the directory folder IIRF, went to properties > security > add > advanced > object types and ticked Computers then clicked OK. Click ‘Find Now’ and it will populate the listbox. Select the IUSR_(YourServerName) and while holding Ctrl, also select IIS_WPG, click OK and OK and then Apply.

If you used the folder C:\WINDOWS\system32\inetsrv (or any folder within the Windws dir) you will probably see the message:

You are about to change the permission settings on system folders, which can result in unexpected access problems and reduce security. Do you want to continue?

Nope! Cancel! Abort! (Only kidding) just click OK.


3) Open the Internet Service Manager (MMC). You can do this via Start…Run…%SystemRoot%\System32\inetsrv\iis.msc or on WinXP  Start > Control Panel > Administrative Tools >Internet Information Services.

4) Select the appropriate level for the ISAPI filter:

– to use the ISAPI filter with all Web sites, select the “Web Sites” icon just under the machine name.
– to use the ISAPI filter with a specific Web site, select the icon for that Web site (for example, the default Web site).

5) Right-click the level (icon) that you selected. Click the Properties button.

6) Click the ISAPI Filters tab.

7) Click Add.

8) Type a name for the ISAPI filter. Eg, “Ionic Rewriter”.

9) Click Browse and select the ISAPI filter DLL that you copied in step 1.

10) Click OK.

11) Stop the IISADMIN service. To do this, either type net stop
iisadmin /y at a command prompt, or use the Services applet that
is located in Administrative Tools

12) Start the World Wide Web Publishing Service.  Do this by typing net start w3svc at a command prompt, or by using the Services applet that is located in Administrative Tools.

For more detailed, general instructions from Microsoft on how to do install ISAPI filters, see here:
http://support.microsoft.com/kb/150312/EN-US/

2 comments

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>