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>
Deploy PHP application on IIS
try this web.config
<?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}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="false" /> </rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
In the config.php file, change $config['uri_protocol']= 'QUERY_STRING'
to $config['uri_protocol'] = 'AUTO'
.
Codeigniter Application Apache to IIS
Resolved by rewriting htaccess for web.config, and changing base_url.
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
change codeigniter .htaccess to web.config error
Codeigniter has it's own routing class which will make you're life much more simple especially if there is possibility of switching between Server OS's.
The following web.config file is the bare basics of getting CI to work with IIS:
<?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|ttf|woff" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Then in application/config/routes.php an example line would be
$route['page/(change_lang)/(.*)'] = 'page/$1/$2';
Hope this helps!
Codeigniter Controller link is not working in IIS
As far as I know, if you want to hosted the Codeigniter in the IIS, you need to add some special url rewrite rule to let your application work well.
I suggest you could install the url rewrite extension for the IIS firstly.
Then I suggest you could try to add below rule into the web.config.
<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>
Related Topics
PHP - Implement Logging Mechanism to File in Several Classes
Adding Two Time Values of Similar Formats Using PHP
How to Format a Number to a Dollar Amount in PHP
Fatal Error: Call to Undefined Function Pg_Connect()
How to Get the Destination Url Using Curl
Mask Credit Card Number in PHP
How to Convert Utc Datetime to Another Timezone
How to Retrieve the Visitor's Isp Through PHP
Multidimensional Array to String
Navigate Back with PHP Form Submission
PHP File-Upload Using Jquery Post
Using Xpath with PHP to Parse HTML
Array Combine Three or More Arrays with PHP
Send Fcm Messages from Server Side to Android Device