【问题标题】:404 page not found the page you requested was not found in codeigniter404 page not found 你请求的页面在codeigniter中没有找到
【发布时间】:2017-06-19 13:07:43
【问题描述】:

我们的代码如下

应用程序/config/config.php

$config['base_url'] = 'http://myworldmirror.com/';  
$config['index_page'] = 'index.php/home';

.htaccess

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

应用程序/配置/数据库.php

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'newsels1',
    'password' => 'newsels1',
    'database' => 'newsels1',
    'dbdriver' => 'mysql',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

输出

当我打开这个网址“http://myworldmirror.com/”时,会显示下面的输出

【问题讨论】:

  • config['index_page'] = 'index.php/home';更改为config['index_page'] = '';
  • 你好 mohammad 试试这个代码但显示同样的错误
  • 解决了我的问题:谢谢兄弟

标签: php .htaccess codeigniter


【解决方案1】:

试试这个

更改$config['index_page'] = 'index.php/home'; $config['index_page'] = '';

.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

application/config/routes.php

中检查您的默认控制器值

$route['default_controller'] = 'welcome';

检查 application/controllers/Welcome.php 是否存在 否则根据您的要求更改 $route['default_controller']

【讨论】:

  • 您确定可以设置 default_controller 的有效值吗?
  • $route['default_controller'] 的哪个值?
  • $route['default_controller'] = 'home' & controller/home.php 可用
  • 请将controller/home.php重命名为controller/Home.php
  • 解决了我的问题:谢谢兄弟
【解决方案2】:

由于我无法为您的问题提供准确的解决方案,请尝试以下方法。任何一种方法都可以找到解决方案。

  1. 删除您的 .htacces 文件并更新 $config['index_page'] = ' ';现在只需尝试 URL http://myworldmirror.com/index.php/homehttp://myworldmirror.com/index.php。 (如果此方法有效,则您的 .htaccess 文件有问题)。

  2. 在 config/database.php 中,只需将 'dbdriver' => 'mysql' 替换为 'dbdriver' => 'mysqli' 并尝试。

请告诉我结果。

【讨论】:

  • 解决了我的问题:谢谢兄弟
【解决方案3】:

http://myworldmirror.com/Home 是工作。

你变了

$route['default_controller'] = 'Home';

$route['default_controller'] = 'home';

【讨论】:

  • @NxsolTeam 现在修复了吗?
  • 解决了我的问题:谢谢兄弟
猜你喜欢
  • 2018-04-18
  • 2016-01-12
  • 2013-07-06
  • 2012-12-30
  • 2018-04-18
  • 2014-02-16
  • 2017-10-13
  • 2020-12-05
  • 2013-10-07
相关资源
最近更新 更多