43967

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

Question:

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 <a href="http://www.1freehosting.com/" rel="nofollow">1freehosting</a>... 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 <a href="http://hello.hostingsiteforfree.com/" rel="nofollow">http://hello.hostingsiteforfree.com/</a>... 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';

Answer1:

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

Answer2:

Look at your application/routes.php and make sure that your $route['default_controller'] is correctly set to your default controller. As follows, this is my routes.php:

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

Also, make sure that your default controller (in my case, its application/controllers/home_controller.php and within it is class Home extends CI_Controller {...}

--

If that doesn't work, make sure your default controller is correctly calling your default view and loading it as such:

$this->load->view('home_view', $data);

--

If THAT doesn't work, then take a look at your application/config/config.php and make sure that the following are correctly set as follows IF you want to get rid of your index.php in the url (for clean urls):

$config['index_page'] = ''; $config['uri_protocol'] = "AUTO";

and if you're going for clean urls, do post your .htaccess (which should follow something like this: <a href="http://www.farinspace.com/codeigniter-htaccess-file/" rel="nofollow">http://www.farinspace.com/codeigniter-htaccess-file/</a>) so we can look at it in further detail and try to fix it if none of the above fix it.

Answer3:

Have you removed index.php with .htaccess? If not then put it in the end.

Recommend

  • What may the reason of change in app signature even i used the same keystore for android app
  • Using the NOW Function In Access
  • What's the key differences in existent approaches to mirror Kafka topics
  • Error occurred during initialization of boot layer FindException: Module not found
  • SQL syntax error
  • .htaccess, Wordpress & vanity URLs
  • More efficient ExpressionEngine server moves
  • Possible to use CodeIgniter output compression with to display code blocks?
  • How to set base path property in swagger for .Net Core Web API
  • ithit-ajax-file-browser active directory WebDav auto-login
  • How do I install these PHP extensions on Ubuntu?
  • Installing SSL cert on Amazon EC2 ELB
  • why route of backbone needs the default route
  • Manage different base layouts in Angular2
  • IIS 7.5 404 Error for .PDF files
  • How to set download location via chrome api
  • React Router and Arbitrary Query Params: Page Refreshes Unintentionally on Load?
  • PWA with multiple pages
  • Tools for understanding HTML layout
  • Upload file that is in the cpan database
  • hide missing dates from x-axis ggplot2
  • Do I need to seed any random number generator before using EVP_PKEY_keygen of OpenSSL?
  • Thread safety of a fluent like class using clone() and non final fields
  • Sort List of Strings By Version
  • CakePHP 2.0.4 - findBy magic methods with conditions
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • one Local Olampyad Questions on Informatic in 2011
  • Highlight one bar in a series in highcharts?
  • DomPDF {PAGE_NUM} not on first page
  • javascript inside java/jsp code
  • htaccess rewriting URLs with multiple forward slashes
  • Display Images one by one with next and previous functionality
  • Web-crawler for facebook in python
  • A cron job substitute?
  • KeystoneJS: Relationships in Admin UI not updating
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF