I am new to the codeigniter. After developing a web app on my localhost .So i uploaded my site on server 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.
I am getting a 404 Page Not Found. The page you requested was not found. I dont know what is going wrong ..i have searched a lot but nothing helps. and my .htaccess file is empty ..means there is not a single line in it. and one more thing is that i purchase this from godaddy hosting may be helpfull.
my routes.php
$route['default_controller'] = '';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
my controller doctorscont.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Doctorscont extends CI_Controller {
public function index() {
here is my code..... */
}
}
and my config > config.php
$config['base_url'] = '';
$config['index_page'] = 'index.php';
[1]:
You have to define doctorscont's route in routes.php.
Please add this line at the end of routes.php then visit
$route['doctorscont'] = 'Doctorscont';
If you still get 404 error, please try If it opens, you may want to remove index.php on URL. For this task, visit CodeIgniter URLs Guide
Edit:
Create a .htaccess file under your root (same folder with system and application) with the content below:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Than open config.php and edit this line:
$config['index_page'] = 'index.php';
to this:
$config['index_page'] = '';
Now you can get what you want.
In version 3+ the filenames must contain the first letter of each file as upper case. It will work in lowercase in your localhost environment but not on server.
Rename the file to 'Doctorscont.php' and you can use the class names as lowercase.
class Doctorscont extends CI_Controller
Edit: http://www.codeigniter.com/user_guide/general/controllers.html#let-s-try-it-hello-world
It seems you have not made some changes at apache2 config level please do below changes.
1)sudo a2enmod rewrite
2)gedit /etc/apache2/apache2.conf
3)add below to end of your conf file
<Directory /var/www/html/>
AllowOverride All
</Directory>
4) Restart apache2 service by below command. service apache2 restart
Best of luck.
</div>