Codeigniter 404 Error On Live Server

偶尔善良 提交于 2019-12-23 19:42:11

问题


i changed my controller name from controller.php to Controller.php also changed my base_url in config file to the directory where my website is hosted like www.abc.com/websitefolder but still i am getting 404 error website url : www.cyfers.com/moving/

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

my .htaccess code

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


回答1:


Your Base URL should be

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

In htaccss

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

Your Controller file should be dashboard.php.

And default controller should be $route['default_controller'] = "dashboard";


To hide errors on site in root there is file call index.php

Change this to

define('ENVIRONMENT', 'development');

this

define('ENVIRONMENT', 'production');


来源:https://stackoverflow.com/questions/35141971/codeigniter-404-error-on-live-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!