我在IIS上使用Codeigniter v2.2。我已经安装和配置了PHP,当我编写纯PHP代码时,它可以工作,包括超链接,但是当我试图访问CI控制器的任何方法时,我得到错误消息"没有指定输入文件"。下面是我的网。配置文件:
<?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';
我不明白我做错了什么?请建议。
也许你得看看这个指南:
https://github.com/EllisLab/CodeIgniter/wiki/Godaddy-Installation-Tips查看了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" />
我已经更改了config.php中的设置
$config['index_page'] = 'index.php?';
$config['uri_protocol'] = 'QUERY_STRING';
它可以为我工作,但url现在像http://www.example.com/Admin/index.php?/Login
它包含index.php?无论如何,网站现在正在工作。url的问题我也会解决的