我在使用CodeIgniter处理共享主机帐户时遇到问题。网址为http://test.tallgreentree.com。它没有给我一个.php错误,但它显示了我在地址栏中键入的所有内容的404页。
这是我的config.php文件的开头。
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
*/
$config['base_url'] = "http://test.tallgreentree.com/";
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "index.php";
/*
|--------------------------------------------------------------------------
| 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";
将CodeIgniter与子域一起使用时是否存在已知问题?可能是什么导致了这个?我尝试了多种配置,但似乎没有什么对我有用。我应该向托管服务提供商查询哪些服务器设置?
感谢大家的时间和帮助。
答案 0 :(得分:1)
变化
$config['uri_protocol'] = "AUTO";
到
$config['uri_protocol'] = "REQUEST_URI"
并查看是否修复了它
另外,您是否具有与文件名相同的类控制器名称?
filename = test.php
class Test ...
答案 1 :(得分:1)
在config.php文件中进行2次更改
首先是:
`$config['uri_protocol'] = "AUTO";`
到
`$config['uri_protocol'] = "REQUEST_URI"`
第二个是:
$config['index_page'] = 'index.php';
到
$config['index_page'] = 'index.php?';
答案 2 :(得分:0)
我使用了“REQUEST_URI”,但是我只能点击我的主页。所有其他链接(到控制器)始终刷新到主页。它显示正确的URL但是无论您点击什么URL,都会将您带到主页,这有点奇怪。
有什么想法吗?我有一个.htaccess文件,
RewriteEngine on RewriteBase / testci RewriteCond%{REQUEST_URI} ^ system。* RewriteRule ^(。)$ /index.php/$1 [L] RewriteCond%{REQUEST_FILENAME}! - f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule ^(。)$ index.php / $ 1 [L] RewriteCond $ 1!^(index.php | images | captcha | css | js | robots.txt) addType text / css .css