When I upload my fully working codeigniter app on live server it did not find any controller and cotroller action.
For example:
my local url is:
localhost/myapp/index.php/testcontroller/testaction
Yes, It works fine, But when I upload the same thing and url becomes:
livesite.com/index.php/testcontroller/testaction
It does not work. Shows error that cant fine the controller. I am wondering why it is happening so while it is working on local server.
controller code:
<?php
class Ajaxification extends CI_Controller{
public function __construct() {
parent::__construct();
$this->load->database();$this->load->model('MAjaxification');
}
public function Index(){
}
public function getUserDetail(){
$this->load->model('MAjaxification');
$uid = $_REQUEST['uid'];
echo $this->MAjaxification->getUserdetail($uid);
// echo "A test response";
}
public function getRandomUser(){
$top = $_REQUEST['top'];
$left = $_REQUEST['lef'];
// $this->load->model('MAjaxification');
// print_r($this->MAjaxification->getRandomDonoers());*/
$this->db->select("users.sno,users.full_name,users.userid,users.email,users.pic");
$this->db->from('users');
$this->db->join('donors','users.userid=donors.userid');
$this->db->order_by('rand()');
$this->db->limit(51);
$res= $this->db->get();
foreach ($res->result() as $row)
{
?> <div style="border:0px solid black; width: 31px; height: 29px; float: left;">
<a onclick="getUserinfoDetail('<?=$row->userid?>')" href="javascript:void(0)"><img width="40" height="40" src="../profile_pix/<?=$row->pic; ?>" /></a>
</div><?php
}
}
private function countUsers(){
$this->db->select("users.sno,users.pic");
$this->db->from('users');
$this->db->join('donors','users.userid=donors.userid');
$res = $this->db->get();
return $res->num_rows();
}
function getRandUser($f=1,$t){
$index = rand($f, $t);
return $index;
}
public function testme(){
echo "This is a test";
}
}
?>
I never worked with Codeigniter, but if it is similar to Kohana, you have to setup the base_url. [EDIT] Check this post from CodeIgniter forum: https://github.com/EllisLab/CodeIgniter/wiki/Automatic-configbase-url