Welcome Guest, Not a member yet? Register   Sign In
Newly installed CI, can't access home controller?
#1

[eluser]solid9[/eluser]
Hi

I've just installed CI in my website.
The welcome page is displaying properly.

I installed it in a specific folder
mysite.com/pies/

Now I created a controller namely home.php
When I tried to access it, it display this error below,

Code:
Not Found
The requested URL /pies/home/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Also these are the codes for the controller home.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {


public function __construct() {
  parent::__construct();

  $this->load->helper('form');
  $this->load->helper('html');
  $this->load->helper('url');
  $this->load->model('ion_auth_model');
  $this->load->model('bs_model');
  $this->load->library('session');
  $this->load->library('ion_auth');
  $this->load->library('form_validation');
  $this->load->library('email');
  $this->load->library('pagination');
  $this->load->library('table');
}

public function index()
{
  //$this->load->view('welcome_message');
  echo 'Just a test :)';
}


}

/* End of file home.php */
/* Location: ./application/controllers/home.php */

What could be I'm missing here?


#2

[eluser]meigwilym[/eluser]
You need to put /home/ in the url.

/pies/home/ would look for the pies controller's home method.

(This is, of course, assuming that you've installed CI in the root, and not in the /pies directory.

Mei
#3

[eluser]solid9[/eluser]
I installed it in the /pies/ directory.
So what's the right path?

/pies/ is the sub folder where CI is installed.
/home/ is the name of the controller.
/coco/ is the method.

I wrote something like this below,

http://mysite.com/pies/home/coco/

BUt the error is still the same.

What could be the reason?

Thanks in advanced.
#4

[eluser]solid9[/eluser]
here is the updated home controller,

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {


public function __construct() {
  parent::__construct();

  $this->load->helper('form');
  $this->load->helper('html');
  $this->load->helper('url');
  $this->load->model('ion_auth_model');
  $this->load->model('bs_model');
  $this->load->library('session');
  $this->load->library('ion_auth');
  $this->load->library('form_validation');
  $this->load->library('email');
  $this->load->library('pagination');
  $this->load->library('table');
}

public function index()
{
  //$this->load->view('welcome_message');
  echo 'Just a test :)';
}

public function coco()
{
  echo 'coconut';
}
}

#5

[eluser]Matalina[/eluser]
Is your index.php removed by .htaccess? and not in the config file?
#6

[eluser]InsiteFX[/eluser]
Did you setup your config.php base_url correct?
#7

[eluser]solid9[/eluser]
@matalina
I remove the index in the config just like this one below,
Code:
$config['index_page'] = '';
And I'm using the latest version.


@InsiteFX
Below is my base_url except for the word sample
Code:
$config['base_url'] = 'http://sample.com/pies/';
#8

[eluser]Matalina[/eluser]
is your .htaccess file correct?
#9

[eluser]solid9[/eluser]
@matalina

What do you mean by .htaccess file?
I don't use it.

I use the latest version, I just uploaded everything into my website.
#10

[eluser]CroNiX[/eluser]
You can't remove index.php from the url without using an htaccess file and mod_rewrite.

Try going to http://yoursite.com/pies/index.php/home

To remove the index.php from the url with htaccess, read
http://ellislab.com/codeigniter/user-gui.../urls.html




Theme © iAndrew 2016 - Forum software by © MyBB