Codeigniter没有指定输入文件

时间:2013-09-25 17:11:49

标签: codeigniter

我知道这个问题可能在数千次之前被问过,我看了大部分时间并无法解决我的问题:s

我在godaddy托管公司安装了一个codeigniter框架,我读到我必须创建一个.htacces文件并将此代码放入:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

但这不能解决我的问题,是不是我在另一个域下托管了这个网站? 对于我的ftp的结构如下所示: / facelajm      studenti fxclod

我试图让网站跟随网址www.facelajm.com/studenti打开主页,但是当我尝试登录或注册时它只返回我没有指定输入文件。

有人可以帮助我吗?

4 个答案:

答案 0 :(得分:2)

似乎在某些配置中CI核心错过了规则,我现在使用的.htaccess:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
ErrorDocument 404 index.php

在我的情况下(dev:一个子文件夹,prod:一个“插件域”),这两个额外的线提供了魔力:

RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]

来源: http://www.diegodicamillo.com.ar/blog/2012/09/19/no-input-file-specified-codeigniter-error-problema-resuelto/

答案 1 :(得分:1)

根据您的问题,我理解的是您在域名的子文件夹(&#34; studenti&#34;)中运行codeignitor(&#34; www.facelajm.com&#34;)。所以下面的.htaccess代码可以工作。

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

也不要忘记更改配置文件(application/config/config.php)中的baseurl,如下所示。

$config['base_url'] = "http://www.facelajm.com/studenti"

您在问题中使用的上述.htaccess将适用于子域。 因此,您也可以create a sub domain and map the folder到子域并使用您在问题中使用的代码(以下添加参考)。

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

也不要忘记将配置文件(application/config/config.php)中的baseurl更改为新子域(assuming new sub domain as http://codeignitor.facelajm.com/),如下所示。

$config['base_url'] = "http://codeignitor.facelajm.com/"

答案 2 :(得分:0)

这是我在godaddy上的.htaccess文件,它工作正常:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

如果codeigniter不在根目录中,则问题可能是RewriteBase行。

答案 3 :(得分:0)

请尝试以下代码:

  

重写发动机       RewriteCond%{REQUEST_FILENAME}! - f
      RewriteCond%{REQUEST_FILENAME}!-d
       RewriteRule ^(。)$ /index.php [L]或RewriteRule ^(。)$ index.php?/ $ 1 [QSA,L]