Routing problem on Live server |
My codeIgniter application only shows default controller on live server but runs just fine on local server, the default controller has a view method which displays login page as the first page but submit button wont submit upon providing login details my index.php page is set to production environment below are my config and route files . please help
// Config.php $config['base_url'] = 'http://phpstack-114475326109.cloudwaysapps.com/'; $config['index_page'] = 'index.php?'; $config['uri_protocol'] = 'REQUEST_URI'; //end config.php //routes.php $route['(:any)'] = 'pages/view/$1'; $route['default_controller'] = 'pages/view'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; //end config
Read the Users Guide
The default controller You can NOT use a directory as a part of this setting! What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
You can not use a directory in the default controller:
PHP Code: $route['default_controller'] = 'pages/view'; Your view is in a directory called pages. I can not send you any messages because you have Private messages disabled! What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-14-2017, 08:40 AM)InsiteFX Wrote: You can not use a directory in the default controller: Hi Insite i just enabled my Private message please do reply . I have a controller page called Pages.php with a class called Pages and a method view Thats why I though the routing for the default controller should then be $route['default_controller'] = 'pages/view'; class Pages extends MY_Controller { if (!file_exists(APPPATH.'views/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } public function view($page = 'login') { // rest of code } }
Code: <? (09-15-2017, 11:26 AM)ciadvantage Wrote: Thank you for the input, i tried to add the constructor like you said, check below, but still though the login in page is displayed as the fist page but submit button wont submit upon giving my login in details class Pages extends MY_Controller { public function __construct() { parent::__construct(); $this->load->library('session'); } public function index($page = 'login') { if (!file_exists(APPPATH.'views/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } $data['title'] = ucfirst($page); // Capitalize the first letter f($page == 'dashboard') { $this->load->model('model_student'); $this->load->model('model_teacher'); $this->load->model('model_classes'); $this->load->model('model_marksheet'); $data['countTotalStudent'] = $this->model_student->countTotalStudent(); $data['countTotalTeacher'] = $this->model_teacher->countTotalTeacher(); $data['countTotalClasses'] = $this->model_classes->countTotalClass(); $data['countTotalMarksheet'] = $this->model_marksheet->countTotalMarksheet(); } if($page == 'login') { if($this->session->userdata('logged_in') === true) { redirect('../dashboard'); } $this->load->view($page, $data); } } } Code: ... |
Welcome Guest, Not a member yet? Register Sign In |