ranggadablues
ranggadablues

Reputation: 249

can't call the second function in controller codeigniter

I'm new in codeigniter I have problem

I use my OS X Lion, and I use .htaccess I can call directly localhost/site_folder/ it works like charm, but I have second function in my controller but I can't directly call that function like this localhost/site_folder/function2

here my controller

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

and it's says url not found, why?

thank you

Upvotes: 3

Views: 4593

Answers (4)

Lazarus-CG
Lazarus-CG

Reputation: 96

According to Mushi codeigniter automatically adds index.php to your 'localhost/site_folder/' which is specified in the config.php file (line 38). So to call the function you would have to go to 'localhost/site_folder/index.php/function2'

Upvotes: 0

vinod
vinod

Reputation: 2880

  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';

Upvotes: 1

ranggadablues
ranggadablues

Reputation: 249

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

Upvotes: 1

Shiplu Mokaddim
Shiplu Mokaddim

Reputation: 57690

The default routing scheme is example.com/class/function/id/ Doc

If site_folder is the folder where you have installed codeigniter, Your url to function2 would be,

http://localhost/site_folder/my_site/function2

Upvotes: 1

Related Questions