【问题标题】:Unable to load website on url it open when I enter **www.domain.com/controller**当我输入 **www.domain.com/controller** 时,无法在打开的 url 上加载网站
【发布时间】:2015-07-13 18:27:29
【问题描述】:

我在 CodeIgnitor CI 中开发了应用程序。网站 ID 在本地机器上正常运行。 我的 htaccess 代码如下

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ROOT DIRECTORY NAME/

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

而我的目录结构是

|application
|css
|js
|htaccess
|index

我在 route.php 中为 default_controller 提供了控制器名称

如果我错了,请告诉我?

【问题讨论】:

  • 很难知道你在哪里出错了。除非我们知道你的CI-3版本是什么?控制器名称、控制器功能和route.php是什么
  • 错误信息是什么?有没有出现系统目录?
  • 我认为你的应用程序目录不完整;在 application 目录旁边,您应该有一个包含 CodeIgniter 核心的 system 目录。
  • @Nishant Nair 您是否已将 index.php 配置为删除?如果没有,那么您需要在任何地方使用www.domain.com/index.php/controller
  • 如他所说,当系统文件夹丢失时怎么可能网站ID在本地机器上正常运行

标签: codeigniter


【解决方案1】:

Oppz,在您的文件夹结构中,您忘记上传 system 文件夹。它会解决你所有的问题。

config/config.php(更改此)

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

.htaccess(在应用程序文件夹外)替换这个

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

【讨论】:

    猜你喜欢
    • 2019-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多