1

I have a website on a local wamp server (I have used a virtual host setup). However when I try to link to another controller on the site, I just get a 404 page (not codeigniters 404). I'm sure I'm missing something simple, but what I'm not quite sure.

If in the url I put the website.co.uk/index.php/aboutus I get the page (although it's not got any of my formatting there).

I'm trying to have links in the format: website.co.uk/aboutus

Here is my routes.php

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

$route['(:any)'] = '$1';

Here is my controller that I'm trying to link to:

class Aboutus extends CI_Controller {

   public function index()
   {

    //  $this->load->library('parser');
    //  $this->load->view('header_view');
    //  $this->loadContent();

    //  $this->load->view('footer_view');
        $this->load->helper(array('form', 'url'));
        $data = array();
       $data["title"]  = "Our Story";
       $data["page_content"]    = "here is some page content";
      $this->load->view('aboutus_view', $data);

    }   
}

I am using the follow href tag for the link

<a href="<?php echo site_url('aboutus'); ?> ">

In my config file I have

$config['base_url'] = '';
$config['index_page'] = '';

Has anyone got any ideas as to what I'm missing?

Thank you.

kmm
  • 21
  • 3

2 Answers2

1

It turns out the htaccess I was using was in the wrong directory... It was in the applications directory and it needs to be at the same level as the applications directory not within it!

kmm
  • 21
  • 3
0

If all you are trying to achieve is, removing index.php from url, you don't need to write a routes. You will need to write an apache rewrite rule for that. Please check this answer for that.

Community
  • 1
  • 1
robert
  • 7,691
  • 9
  • 41
  • 68
  • I have tried that but am still having the same issues. I am wondering if it is something to do with my setup? It seems such a simple thing to do, I have tried a lot of different posts suggestions to no avail. – kmm Sep 29 '13 at 14:19
  • does your webserver setup have url rewrite capability? I assume you have apache as wbeserver? Do you have mod_rewrite installed and enabled. – robert Sep 29 '13 at 14:22
  • I have just double checked and mod_rewrite is installed and enabled and I'm still not having any luck. Yes I am using apache as my web server. – kmm Sep 29 '13 at 14:40