Windows
Mod_Rewrite on IIS
by mark on Feb.01, 2009, under Reviews, Windows
Many web developers using IIS, having seen the widespread adoption of mod_rewrite in Apache, have been wondering about what tools are available to them. IIS 7.0 in Vista and Server 2008 has a rewrite module provided by Microsoft, by popular demand. However, users of older versions of IIS have been stuck in the cold with regard to a lack of rewrite options.
Why is it so important?
Many people don’t notice the heavy usage of URL rewrites in popular websites. It is used on this websites to produce the friendly URLs used for permalinks. It is used to erase something unfriendly like an article id “article.php?=132&source?=20″ and change it to /articles/myarticle/source/. This has major benefits for search engine optimization. I used a rewrite rule to change an incredibly unfriendly DNN url to “www.exampledomain.com/blog/”. Having these keywords available in the link drastically helps optimize your inbound links. It can be used for untold other uses as well, since the Apache implementation is fantastically powerful. Rewrite rules are created using regular expressions.
Your Options
Your main two options for IIS are Ionics ISAPI Rewrite and Helicon Tech’s ISAPI Rewrite. Ionic’s is an open source implementation of a rewrite engine, and has been progressing along nicely since when I first used it (started with the 0.8 beta). It works as an ISAPI .DLL that is applied in IIS. The rules are put into an INI file. There are regrettably no way to make separate sites have separate rules barring loading multiple copies of the DLL with multiple INI files. Helicon’s IIS rewrite solution is a lot more mature, and closely follows the Apache implementation. You use .htaccess files to manage rewrites. Furthermore, almost all apache mod_rewrite rules work in Helicon’s solution. The free version only supports one set of rules, but the premium version ($80 at the time of writing) supports .htaccess files in every web directory, with different rules. Overall, I would recommend Helicon’s software, although it would definitely be worth looking at the Ionics project to monitor how well they are doing. The free version of Helicon’s software only has modest restrictions, and is not expensive if you’ve already paid for Windows Server and some SQL server.
Update:
Bill Staples made a note that I neglected to include a link to the IIS7 URL rewrite, so here it is:
http://www.iis.net/extensions/URLRewrite
I just got IIS7 installed on my Vista Ultimate box, so I should have some future posts about leveraging IIS7’s new capabilities for SEO and user friendly web applications!
Fixing “The drive could not be mapped because no network was found”
by mark on Jan.23, 2009, under How-To, Windows
I had a problem with a user who couldn’t mount a network drive. When I would attempt to add the drive manually, I got the error “The drive could not be mapped because no network was found“.
Sitrep:
- Network was working (symptoms occur on both wireless or wired)
- Fileshare mounting WAS working (it would mount another network drive on the same server, also it mounted redirected folders on the same server just fine)
- Can not browse windows network
- Workstation service was running fine
I mention the last one because this knowledgebase article explains that it’s a problem with the windows Workstation Service. I would buy this if I couldn’t mount ANY folders or network drives, but the service seems to be running and restarting it doesn’t affect anything.
My Solution:
- Go to “Network Connections”
- Right click a network connection, go to “Properties”
- Highlight “Client for Microsoft Networks”
- Click “Uninstall”
- Restart computer
- Go to “Network Connections”
- Right click a network connection, go to “Properties”
- Click “Install”
- Select “Client for Microsoft Networks”
- Click through dialogs
- Restart
This worked perfectly for me. The network drive mounted right up afterwards and my problem was solved. Let me know in the comments if this worked for you or if you are stuck somewhere!