I started using codeigniter for the first time today although I have used asp.net mvc before. I am wondering why my URL needs the index.php at the start all of the time ?
example:
http://localhost/index.php/mozilla-developing-chromecast-competitor-that-runs-firefox-os-report
There is no function called index.php in my controller. I am pretty sure this is a silly question but I have been trying to fix it for over an hour and am still clueless.
routes:
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/home';
Controller
class Pages extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('pages_model');
}
public function home()
{
$data['blog'] = $this->pages_model->get_blog();
$data['title'] = 'Blog archive';
$this->load->view('templates/header', $data);
$this->load->view('pages/home', $data);
$this->load->view('templates/footer');
}
public function about()
{
$data['title'] = 'About us';
$this->load->view('templates/header', $data);
$this->load->view('pages/about', $data);
$this->load->view('templates/footer');
}
public function view($slug)
{
$data['blog_item'] = $this->pages_model->get_blog($slug);
if (empty($data['blog_item']))
{
show_404();
}
$data['title'] = $data['blog_item']['title'];
$this->load->view('templates/header', $data);
$this->load->view('pages/view', $data);
$this->load->view('templates/footer');
}
}
HTAaccess
Deny from all