我已经在子目录中安装了 CI www.siteb.com/rexona
我的 .htaccess 内部 www.siteb.com/rexona:
<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>
在配置中.php:
$config['index_page'] = '';
$config['base_url'] = '';
$config['uri_protocol'] = 'AUTO';
每当我尝试访问控制器时,我都会得到未指定输入文件。但是它确实加载了默认控制器,但我也无法访问默认控制器中的任何方法。
有什么想法吗?谢谢。
您的uri_protocol
需要设置为某些内容 - 至少将其设置为自动。
您得到的错误是因为 PHP 以 CGI 形式运行,这意味着您需要将 URL 重写传递给index.php?/$1
(请注意问号)。
Godaddy 托管,它似乎是固定的on.htaccess
,我自己正在通过更改来工作:
RewriteRule ^(.*)$ index.php/$1 [L]
自
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
您的$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['']
读取,这通常是空的。
我在托管免费帐户中遇到相同的错误,请使用上面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]
这项工作很好,非常感谢!