Sunday 5 December 2010

How convert .htaccess file to web.config

I have a requirement to re-define the apache re-write rule to IIS knowing language using web.xml on Windows 2008 server. There is one easy trick to achieve this.

Basic operations are,

1. Install Mod Rewrite component on II7
2. Create a website on IIS and import the .httaccess file

1. Installing Mod Rewrite Module

Download and install Mod Rewrite module from the following url according to your OS architecture.
http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/. Then Close the IIS MMC and reopen it. Now you see that module is present as shown below

Then Click on ” import rules” label showing on the right side of the window tree. Find the .htaccess file and import and t hen click to apply. It will create/update the web.config file in the document root directory.

Here is the sample code which I used for re-writing Codeigniter frame work

It’s file name is “web.config”

















No comments:

Post a Comment