htaccess equivalent (Zend Framework with IIS7)

The Zend Framework relies on a web directive to redirect ALL requests to an index.php page. On an apache server, this is fairly easy to implement using the following statements in a .htaccess file in the public facing folder:

RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

A new feature in IIS7 called ‘URL Rewrite’ makes this easy to realize on WIMP/WISP setups. The GoLive (Production) version of the plugin is available here:


The plugin provides a really neat feature to directly import and convert well formed .htaccess files into their IIS equivalents. Using your IIS manager, navigate to the virtual folder (pointing to your public facing folder). Click on the ‘URL Rewrite’ plugin and then the "Open Feature" option.


Now, click on the "Import Rules" option


In the dialog box that appears, select the .htaccess file saved on your computer and click on the "Import" button.


If all goes well, the equivalent IIS rewrite rules will be created! The above procedure actually creates a web.config file in your public folder that looks like the following (Note that you can actually just copy this web.config to your folder instead of going through the above steps):

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="Imported Rule 1">
                    <match url="\.(js|ico|gif|jpg|png|css)$" negate="true" ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s