การใช้งาน Codeigniter บน IIS สิ่งสำคัญคือ route method ซึ่งโดยปกติแล้ว จะใช้งานได้ บน hosting ที่เป็น Apache โดยไม่ต้อง config อะไร แต่สำหรับ window azure หรือ IIS แล้วจะต้องมีการแก้ไขไฟล์ web.config เพื่อทำการ rewrite url เมื่อต้องการใช้งานจึงมีสิ่งที่ต้องทำ 2 อย่าง เพื่อให้ iis มีการ rewrite เหมือน .htaccess ใน appserv คือ
- install urlrewrite ตามตัวอย่าง ใน clip
- สร้างไฟล์ web.config เพื่อใช้แทน ไฟล์ .htaccess
ตัวอย่างไฟล์ web.config เพื่อการ rewrite
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Index"> <match url="^(.*)$"/> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> </conditions> <action type="Rewrite" url="index.php/{R:1}"/> </rule> </rules> </rewrite> </system.webServer> </configuration>