Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rewrite the index.php of Codeigniter on Windows Azure

How to remove index.php in codeigniter on Windows Azure and IIS?

Can I rewrite the URL for the index.php of Codeigniter without a particular module?

like image 934
Romain Beuque Avatar asked Apr 01 '12 14:04

Romain Beuque


2 Answers

You can add rewrite rules in your web.config file. Add the following to the system.webServer section:

<rewrite>
  <rules>
    <rule name="Rule" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite> 
like image 164
Mischa Avatar answered Nov 13 '22 23:11

Mischa


Create a file name web.config in wwwroot

<?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="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite> 
    </system.webServer>
</configuration>
like image 29
n9ti Avatar answered Nov 13 '22 23:11

n9ti