【问题标题】:Codeigniter 404 Error On Live Server实时服务器上的 Codeigniter 404 错误
【发布时间】:2016-05-10 13:54:20
【问题描述】:

我将控制器名称从 controller.php 更改为 Controller.php 还将配置文件中的 base_url 更改为托管我的网站的目录,例如 www.abc.com/websitefolder 但我仍然收到 404 错误 网址:www.cyfers.com/moving/

我的基本网址:$config['base_url'] = 'http://www.cyfers.com/moving/';

我的 .ht 访问代码

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

【问题讨论】:

  • 向我们展示您的代码、路线、基本网址和托管链接
  • cyfers.com/moving一样托管
  • 请向我们提供更多信息。这就像在说“我的车有问题。是什么问题?”
  • @Abdulla $config['base_url'] = 'cyfers.com/moving';
  • 你的主控制器名称是什么??

标签: php codeigniter server


【解决方案1】:

您的基本网址应该是

$config['base_url'] = 'http://cyfers.com/moving/';

在 htaccss 中

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

你的控制器文件应该是dashboard.php

默认控制器应该是$route['default_controller'] = "dashboard";


要在根目录中隐藏站点上的错误,有文件调用index.php

改成

define('ENVIRONMENT', 'development');

这个

define('ENVIRONMENT', 'production');

【讨论】:

  • 是的,它已经存在了..我在我编辑的答案中提到了.. RewriteBase / RewriteCond $1 上的 RewriteEngine 仍然是同样的问题!^(index.php|resources|robots.txt) RewriteCond %{REQUEST_FILENAME}! -f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]
  • 更改您的基本网址并上传项目
  • 我改变了..但还是一样
  • 现在也添加我的 htaccess
  • shoe me Dashboard 文件名和类名
猜你喜欢
  • 1970-01-01
  • 2015-06-07
  • 2016-11-13
  • 2017-09-04
  • 1970-01-01
  • 1970-01-01
  • 2019-09-01
  • 1970-01-01
  • 2019-03-19
相关资源
最近更新 更多