I set default controller like this
$route['default_controller'] = "InterviewController";
So here is InterviewController's code
class InterviewController extends CI_Controller{
private $em;
function __construct() {
parent::__construct();
}
public function index() {
$commentsList = array();
$commentsList['comments'] = $this->em->getRepository('Entities\Comment')->findPage(1, 10, 'DESC', $this->em->getRepository('Entities\Interview')->getLast()[0]->getId());
$lastInterviewsAnons = array();
$lastInterviewsAnons['lastInterviewsAnons'] = $this->em->getRepository('Entities\Interview')->getLast();
$this->load->view('header');
$this->load->view('navbar');
$this->load->view('content', $lastInterviewsAnons);
$this->load->view('addCommentPanel');
$this->load->view('commentsList', $commentsList);
$this->load->view('footer');
}
}
Everything works perfect in my local machine, but on server i get 404 error. I can access this controller only by typing full url like http://mydomain.com/index.php/InterviewController. Seems like instruction in routes file doesn't work. What can you advise?
Please check your htaccess file for rewrite codes. If it is ok then try below steps.
1) Change Class name to
class Interview extends CI_Controller
2) File name to interview.php
3) And in routes.php $route['default_controller'] = "interview";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With