Rajan
Rajan

Reputation: 21

How to set default page in codeigniter

I have set routes in routes.php for my default page but it shows a 404 error when opening localhost/mywebsite

$route['default_controller'] = "page";
$route['404_override'] = 'page';

I have set the above code in routes.php which gives a 404 error. The page controller has been created.

Upvotes: 0

Views: 6222

Answers (2)

Raja Ram T
Raja Ram T

Reputation: 9071

You configured default controller & 404_override URL with the same value.

When ever you access to your web site automatically open page controller index function

ie ur_project_url/page/index

OR

ur_project_url/index.php/page/index

when ever you can get the 404 error also open same page controller index function

ie ur_project_url/page/index

OR

ur_project_url/index.php/page/index

please check your controllers and function and routes ,htacess file

please remove your url index.php using htacess

in config folder $config['log_threshold'] = 0; to $config['log_threshold'] = 1; check log files

Upvotes: 0

muktesh patel
muktesh patel

Reputation: 41

You need to make sure following things:

  1. Webserver rewrite module is installed
  2. htaccess file is properly configured
  3. index function is present in page controller

Upvotes: 1

Related Questions