Can't call second function in codeigniter controller

I'm new to codeigniter I have a problem

I am using my OS X Lion and I am using .htaccess

I can call directly localhost / site_folder / it works like a charm but I have a second function in my controller but I cannot directly call this function like this localhost / site_folder / function2

here is my controller

class My_site extends CI_Controller {
function __construct() {
  parent::__construct();
  }
function index() {
  --some script--
  }
function function2() {
  --some script--
  }
}

      

and it says url not found why?

Thank you

+3


source to share


4 answers


I found solutions on this forum http://ellislab.com/forums/viewthread/210578/



+1


source


Default Routing Scheme: example.com/class/function/id/

Doc

If site_folder

is the folder where you installed codeigniter your url for function2

will be,



http://localhost/site_folder/my_site/function2

      

+1


source


  It may be the issue please Check the uri protocol in the config file that should be AUTO.

  Config/config.php ===> $config['uri_protocol']    = 'AUTO';

      

+1


source


According to Mushi, codeigniter will automatically add index.php to your 'localhost / site_folder /' file which is specified in config.php file (line 38). So to call the function you need to go to "localhost / site_folder / index.php / function2"

0


source







All Articles