没有指定的输入文件 - IIS上的Codeigniter

时间:2014-07-07 05:50:48

标签: php codeigniter continuous-integration

我在IIS上遇到了Codeigniter v2.2。我安装并配置了PHP,当我编写普通的PHP代码时,它的工作包括超链接,但是当我尝试访问CI控制器的任何方法时,我收到错误消息"没有指定输入文件"。下面是我的web.config文件:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="MyRule">
                    <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>  

我的config.php设置如下:

$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

我不明白我做错了什么?请指教。

3 个答案:

答案 0 :(得分:0)

也许您必须阅读本指南:

https://github.com/EllisLab/CodeIgniter/wiki/Godaddy-Installation-Tips

它帮助我们许多人理解为什么会出现错误。

答案 1 :(得分:0)

看看PumpKing给出的链接,发现我犯了一个愚蠢的错误。这就是我所做的并让它发挥作用:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="MyRule">
                    <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>

我更改了以下代码:

<action type="Rewrite" url="index.php/{R:1}" appendQueryString="false" />

<action type="Rewrite" url="index.php?/{R:1}" appendQueryString="false" />

答案 2 :(得分:0)

我在config.php中更改了设置

$config['index_page'] = 'index.php?';
$config['uri_protocol'] = 'QUERY_STRING';

它对我有用,但网址现在就像http://www.example.com/Admin/index.php?/Login

它包含index.php? ,无论如何网站现在正在运作。我也会弄清楚网址问题。