Search code examples
phpcodeigniteriisweb-configplesk

Codeigniter Application Apache to IIS


I have a codeigniter application running in Linux environment and would like to migrate it to Windows environment.

I migrated the files via FTP. The homepage worked correctly with images and styles, but the links do not and show error 404.

Does it have to do with htaccess and web.config?


Solution

  • 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>