首页 > 解决方案 > Codeigniter 应用程序 Apache 到 IIS

问题描述

我有一个在 Linux 环境中运行的 codeigniter 应用程序,并希望将其迁移到 Windows 环境。

我通过 FTP 迁移了文件。主页可以正常使用图像和样式,但链接不能正常工作并显示错误 404。

它与htaccess和web.config有关吗?

标签: phpcodeigniteriisweb-configplesk

解决方案


通过为 web.config 重写 htaccess 并更改 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>


推荐阅读