【问题标题】:CodeIgniter Install ProblemCodeIgniter 安装问题
【发布时间】:2009-02-19 18:05:38
【问题描述】:

我在让 CodeIgniter 使用我的共享主机帐户时遇到问题。 URL 是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 与子域一起使用时是否存在已知问题?这可能是什么原因造成的?我尝试了多种配置,但似乎没有什么对我有用。我应该向我的托管服务提供商检查哪些服务器设置?

感谢大家的时间和帮助。

【问题讨论】:

  • 您是否尝试过从该目录中访问其他任何内容?也许是一张图片?

标签: php apache codeigniter frameworks shared-hosting


【解决方案1】:

改变

$config['uri_protocol'] = "AUTO";

$config['uri_protocol'] = "REQUEST_URI"

看看能不能解决

另外,你的类控制器名称是否与文件名相同?

文件名 = test.php

class Test ...

【讨论】:

  • 我已经做出了改变,但仍然没有喜悦。我正在使用带有默认控制器和视图的 codeigniter 1.7.1。我没有对这些文件进行任何更改。控制器名称和文件名匹配。
  • 等等,现在它正在工作。我认为我第一次上传到服务器没有采取。感谢您的回答!
【解决方案2】:

我使用“REQUEST_URI”来解决这个问题,但我只能点击我的主页。所有其他链接(到控制器)总是刷新到主页。有点奇怪,它显示了正确的 URL,但无论您单击哪个 URL,都会将您带到主页。

有什么想法吗?我确实有一个 .htaccess 文件,

重写引擎开启 重写基础/testci RewriteCond %{REQUEST_URI} ^system.* 重写规则 ^(.)$ /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

【讨论】:

    【解决方案3】:

    在 config.php 文件中进行 2 处更改

    第一个是:

       `$config['uri_protocol'] = "AUTO";`
    

       `$config['uri_protocol'] = "REQUEST_URI"`
    

    第二个是:

        $config['index_page'] = 'index.php';
    

        $config['index_page'] = 'index.php?';
    

    【讨论】:

      猜你喜欢
      • 2021-05-10
      • 2021-06-25
      • 2020-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-31
      • 2016-12-13
      相关资源
      最近更新 更多