404 Page Not Found The page you requested was not found. Code igniter [closed]

 

Questions


i have developed a web app on code igniter .. this is the first time i am working on code-igniter .. after developing a web application on my localhost .so i decided to put my code-igniter web app on the temporary free server.. so i uploaded my site on this site
1freehosting… and then i imported my database .. after that i have changed the settings of database in database.php file .. and also i changed the base url in config.php file ..as this is my domain name http://hello.hostingsiteforfree.com/… so i changed it to this url .. but then i am getting a following error … i dont know what is going wrong ..i have searched a lot but nothing helps.. and also i am forgot to mention that my .htaccess file is empty ..means there is not a single line in it

this is the error i am getting

404 Page Not Found

The page you requested was not found.

routes.php

    <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

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


 /* Location: ./application/config/routes.php */

my controller

   <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class LoginController extends CI_Controller {

 function index(){

    $new['main_content'] = 'loginView';
    $this->load->view('loginTemplate/template', $new); 

}




function verifyUser(){

    //getting parameters from view 
    $data = array(
            'username' => $this->input->post('username'),
            'password' => $this->input->post('password')
    );


    $this->load->model('loginModel'); 
    $query = $this->loginModel->validate($data);


          if ($query){             //if the user c validated
        //data variable is created becx we want to put username in session
            $data = array(
                'username' => $this->input->post('username'),
                 'is_logged_in' => true 
            );

           $this->session->set_userdata($data);
         redirect('sessionController/dashboard_area');
    }
    else
     {
        $this->index();
    }
}
function logout()
{
    $this->session->sess_destroy();
    $this->index();
}
}



?>

config file

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

 

 

————————————————-

Answer

Since you do not have any .htaccess to edit you url you must add an index.php
when calling a controller like

http://hello.hostingsiteforfree.com/index.php/loginController

I tried accessing it via the url above and it works, but the database connection is not set up properly

in your config file where there is $config['index_page'] = '' if it is blank add an index.php to it

Check to see it works

.htaccess,codeigniter,hosting,php,webserver

Facebook Comments

Post a comment