Ionics ISAPI Rewrite module with Code Igniter

by Buddy Lindsey on August 16, 2008

One thing that apache has is mod_rewrite, but IIS doesn’t seem to have it nativly.  However, Ionics made an ISAPI filter and submitted it to CodePlex for people to use for free.  To get it to work in Code Igniter is pretty easy once you do it for the first time.  As a note it is best to do it per site.  Here are the steps and some images.

1) Download files from codeplex site (http://www.codeplex.com/IIRF)

2) Unzip IsapiRewrite4.dll

3) Put IsapiRewrite4.dll in folder of the top level of the website (wwwroot/default site)

4) create .ini file named IsapiRewrite4.ini (Must be named IsapiRewrite.ini)

5) Open IIS Manager

6) Right-click on site -> properties

7) Isapi Filters Tab

8) Add…

9) Name filter what ever you want. I named it IONICS Rewrite

10) Click browse and load the IsapiRewrite4.dll in the top level of the site

11) add the code below to the .ini file

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php/$1 [L]

12) recycle the application pool and all should work.

I got the snippet for the ini file from the CodeIgniter forum, but can’t seem to find exact post to link to.  There are a lot of things that you can do with this rewrite module much similar to mod_rewrite for apache.

Also as a side note this works awesom for wordpress blogs too to get good permalinks.

Related Posts:

Was this Helpful?

If you found this article useful you might find others useful as well. Please browse the archives and subscribe to the RSS Feed to stay up-to-date.

Leave a Comment

Previous post:

Next post: