笨没有输入文件中指定的错误(Codeigniter no input file specified

2019-06-24 00:52发布

我已经安装在subdirecotry www.siteb.com/rexona CI

我里面www.siteb.com/rexona的.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /rexona

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#‘system’ can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn’t true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>

ErrorDocument 404 /index.php
</IfModule>

在config.php:

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

每当我尝试访问控制器我收到没有指定输入文件 。 但是它确实负荷默认控制器,但我不能或者访问默认控制器的任何方法。

有什么想法吗? 谢谢。

Answer 1:

uri_protocol需要设置的东西-至少它设置为自动。

你所得到的错误是因为PHP运行作为CGI这意味着你需要通过URL重写index.php?/$1代替(注意问号)。



Answer 2:

Godaddy的主机,它似乎固定on.htaccess ,自己这是通过改变工作:

RewriteRule ^(.*)$ index.php/$1 [L]

RewriteRule ^(.*)$ index.php?/$1 [QSA,L]


Answer 3:

$config['uri_protocol']不能为空。 默认为AUTO ,在传递一个空字符串将打破核心URI类,它通过路由器类用于对您的请求。

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'            Default - auto detects
| 'PATH_INFO'       Uses the PATH_INFO
| 'QUERY_STRING'    Uses the QUERY_STRING
| 'REQUEST_URI'     Uses the REQUEST_URI
| 'ORIG_PATH_INFO'  Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'AUTO';

正如评论说:“如果你的链接似乎不工作,尝试其他口味的美味之一”。
空字符串不是那些香料之一,它最终会尝试读取$_SERVER['']这通常会是空的。



Answer 4:

我得到了hostinger免费帐户相同的错误,与上述JHON富提出的问题解决。

我的.htaccess

RewriteBase /MY_SUBFOLDER_UNDER_HTML_DIRECTORY/
RewriteEngine on

RewriteBase /mY_subfolder/
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$0 [QSA,L]

这项工作很好,非常感谢!



文章来源: Codeigniter no input file specified error