views:

179

answers:

1

I'm working with code igniter and for some reason, the url http://mysite.com/account/100 gives me a 404 error but http://mysite.com/account actualy works. Here's what my controller account.php looks like.

   class account extends Controller {


    function account()
    {
      parent::Controller();
    }

    function index()
    {
     echo 'hello';
      echo $this->uri->segment(2);
    }
    }

Any idea what's wrong?

A: 

I just tested a simple account class like you have and it is trying to call 100 as a method of account, instead your URL after index.php should be account/index/100 and it works fine.

This can be solved using routing for example.

$route['account/(:num)'] = "accounts/index/$1";

is what you are looking for. You can look over the URI Routing user guide for more info.

CodeIgniter requires that your controller name be capitalized, and the filename lowercase so try changing your controller to.

class Account extends Controller { }

and your filename account.php

Cory
sorry, that was just a typing mistake in my question. I actually ahve the bracket in my controller and it is named account.php
John