我们的代码如下
应用程序/配置/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
应用程序/配置/database.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
);
输出
当我打开此 url“http://myworldmirror.com/”时,显示以下输出
最佳答案
试试这个
更改$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 中的默认 Controller 值
$route['default_controller'] = 'welcome';
检查application/controllers/Welcome.php 是否存在否则根据您的要求更改$route['default_controller']
值 p>
关于php - 404 page not found 您请求的页面在 codeigniter 中找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42002599/