Scripting URL rewrite module configuration

URL rewrite module fully utilizes extensibility of IIS 7.0 configuration system. The rewrite rules are stored in applicationHost.config and web.config files in XML format. This provides a huge benefit of being able to use rich set of IIS 7.0 management tools and API’s for managing and scripting URL rewriter configuration. For example, you can automate any configuration task, including creating, editing and deleting of rewrite rules, by:

The Configuration Editor, included in the Administration Pack for IIS 7.0, greatly simplifies the process of generating scripts for automating URL rewriter configuration. In this post, I will demonstrate how to use the Configuration Editor to automate configuration of rewrite rules.

Continue reading “Scripting URL rewrite module configuration”

IIS.NET uses URL rewrite module

IIS.NET team has been very proactive in helping us out with testing of URL rewrite module. In fact, they even agreed to deploy the latest build of the module on the production server that hosts http://www.iis.net. This kind of real-life deployments really helps us validate the features and functionality of the module. And being able to do this validation so early in release cycle gives us a good opportunity to adjust the feature set, re-consider some of the design decisions, or just find some very good bugs.

IIS.NET has URL rewriting requirements, which are typical for large content management systems. The articles on the site are often moved or updated and the old links should continue to work. Or there is a need to have a nice URL (for example – http://www.iis.net/fastcgi) for a page that currently has some meaningless URL (e.g. http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1521). IIS.NET has more than a hundred of such URL mappings. Majority of those mappings are static, so there is no need to use regular expression patterns, capture groups, back-references or any other advanced URL rewriting stuff. Rewriting logic is very simple:- for example if input URL is “/php” then rewrite it to “/default.aspx?tabid=50001”. But if we tried to define this logic by creating a rewrite rule per URL mapping we would end up with more than a hundred of rules, which would be evaluated for every request. That would kill the performance of the web site.

Continue reading “IIS.NET uses URL rewrite module”

Per-site PHP configuration with IIS FastCGI

There have been a few questions on IIS.NET PHP forum regarding enabling per-site PHP configuration. This is a common requirement when running PHP applications in shared hosting environment, because each PHP application may require a different set of PHP settings. Shared hosting providers often want to provide their customers with an option of controlling PHP configuration if necessary.

Until recently, it was thought that per-site PHP configuration was only possible when running PHP on Apache in *nix based OS. However, with FastCGI module it is possible to enable this for PHP applications hosted on IIS 6.0 and IIS 7.0.

The development team at GoDaddy.com has researched and validated several options for enabling per-site PHP configuration on Windows. Based on their findings, we have updated the PHP shared hosting guide with instructions on how to allow per-site php.ini files when running PHP via FastCGI on IIS 7.0. In this post I will explain how to accomplish the same on IIS 6.0 by using FastCGI extension.

Assume we have two web sites in IIS 6.0 – website1.com and website2.com. We want each web site to use its own version of php.ini file. Let’s assume that php.ini for website1.com is located in C:\Inetpub\website1.com folder and php.ini for website2.com is located in C:\Inetpub\website2.com folder.

Continue reading “Per-site PHP configuration with IIS FastCGI”

Introduction

My name is Ruslan Yakushev. I am a program manager on IIS team, working on some of the very interesting projects that are being developed in the team right now. I have joined the team about a year ago, and was thinking about starting a blog for a while now. The primary work responsibilities kept me busy, so I have been postponing blog idea for a while. Every time I needed to make an announcement or an update on IIS community site, I asked some of my colleagues  on the team to blog my content. Finally, I figured that I should probably start my own blog, so I could have all the freedom of publishing my own content any time I want.

Being a technical program manager on the team, I like to use (in other words – “dogfood”) the products that team develops. Hence I decided to self-host my own blog by using latest version of IIS. Also, I have been working with FastCGI and PHP for a while now, and became quite familiar with many popular PHP applications. As a result I chose to run my blog by using latest version of WordPress, which is a very nice and easy to use blog engine application. Finally, I am using my favorite feature of IIS 7.0 – URL rewriter – to enable “pretty permalinks” on my blog.

I plan to use this blog to publish information related to FastCGI, PHP, URL rewriter and IIS in general. I hope you’ll find this content useful.