6

我已经在子目录 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';

每当我尝试访问控制器时,我都会得到No input file specified。但是它确实加载了默认控制器,但我也无法访问默认控制器中的任何方法。

有什么想法吗?谢谢。

4

4 回答 4

24

uri_protocol需要设置一些东西 - 至少将其设置为自动。

您收到的错误是因为 PHP 作为 CGI 运行,这意味着您需要将 URL 重写传递给index.php?/$1(注意问号)。

于 2012-04-28T08:44:20.380 回答
4

Godaddy 托管,似乎是固定on.htaccess的,我自己通过更改来工作:

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

RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
于 2013-03-18T13:45:36.437 回答
1

你的$config['uri_protocol']不应该是空的。默认值为AUTO,传入一个空字符串将破坏核心 URI 类,该类用于通过 Router 类路由您的请求。

/*
|--------------------------------------------------------------------------
| 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[''],这通常是空的。

于 2012-04-28T08:11:41.943 回答
0

我在托管免费帐户中遇到了同样的错误,解决了上面 jhon foo 提出的问题。

我的 .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]

这工作很好,非常感谢!

于 2015-09-22T02:26:18.503 回答