Codeigniter 2 on IIS with web.config file
Have you look at the example in the CI forums?
http://codeigniter.com/forums/viewthread/91954
<?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer> <rewrite> <rules> <rule name="Rewrite to index.php"> <match url="index.php|robots.txt|images|test.php" /> <action type="None" /> </rule> <rule name="Rewrite CI Index"> <match url=".*" /> <conditions> <add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule> </rules> </rewrite> </system.webServer></configuration>
i have placed the following web.config code in the root and it worked perfectly.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Imported Rule 1" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^system.*" ignoreCase="false" /> </conditions> <action type="Rewrite" url="/index.php?{R:1}" /> </rule> <rule name="Imported Rule 2" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> <add input="{R:1}" pattern="^(index\.php|images|robots\.txt|css)" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php?{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
It turns out I didn't have Rewrite installed. This did the trick:
http://www.iis.net/downloads/microsoft/url-rewrite
I'm not sure if codeigniter's error page may have masked the error somewhat, because I couldn't determine that it wasn't installed from the browser's error screen. Also Event Viewer, IIS logs, and PHP logs all were not helpful for this situation.