I have been aware for some time about URL Rewriting on Apache via a .htaccess file. But recently working with Umbraco I discovered that version 4 incorporated a rewriting library to enable its use in virtual directories and provide friendly URLs, http://www.urlrewriting.net/149/en/home.html. Some further research showed quite a number of rewriting libraries for IIS using ISAPI or HTTPModules:-
What was more surprising was that my Hosting company had already installed version 3 of Helicontech’s ISAPI_Rewrite onto the Windows shared hosting I use. Therefore, it seemed an easy option for me to use it, but it has been a complete disaster.
Of course, with my first attempts I got the rules wrong and the rewriting just failed without any way of seeing the logs or error reports, as the Host company are the only persons able to access them. Eventually, with careful reading of Helicontech’s documentation I learned that when a .htaccess is in the root of a site the library removes a /, see http://www.helicontech.com/isapi_rewrite/doc/troubleshooting.htm
So if your rules start with a ‘/’ character, this should be removed in .htaccess file in the root folder of web site.
Once I sorted my rules problems I found that changes to the .htaccess where not being responded to. Sometimes I got 2 of 3 rule changes and then nothing in 24hr. Helicontech’s forum support informed me that the most likely reason was NTFS permissioning, and “List Folder Contents” was needed. I wrote myself simple ASP.NET website to look at the users and permissions assigned to the directories and I could see that they were correct. Raising tickets with my Hosting company got helpful responses which resulted in the current rule being updated, but a few hours later I was back to the same situation of changes to .htaccess being ignored. It seems that file watching is done using an internal method, System.Web.FileChangesMonitor and and I found suggestions during my research that some changes do get missed. This method is different from the .Net System.IO.FileSystemChanges method.
Well after a week I’ve decided to give up with ISAPI extensions rewriting. Since ASP.NET has a HTTPModules feature and Managed Fusion has an interesting open source product, I’m going to try this and I’ll be sure to blog about it in the future.