0
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *      http://example.com/index.php/welcome
     *  - or -
     *      http://example.com/index.php/welcome/index
     *  - or -
     * Since this controller is set as the default controller in
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see https://codeigniter.com/user_guide/general/urls.html
     */
    public function index()
    {
        $this->load->view('welcome_message');
    }
    public function aboutus()
    {
        $this->load->view('aboutus');
    }
}

" I want to call aboutus function in order to call the view 'aboutus'. " *This should be the url -http://localhost/codeIgniter/aboutus

when i call this url , i get the error as "Object not found"

how can i call the aboutus function ?

Deepak dev
  • 11
  • 6
  • 1
    use routes for that or create controller with the name of aboutus. – Devsi Odedra May 14 '18 at 04:18
  • http://localhost/codeIgniter/index.php/welcome/aboutus , this is the current url which works fine, but i want to remove the index.php .so that i get the url http://localhost/codeIgniter/welcome/aboutus. for this purpose , what should i do ? – Deepak dev May 14 '18 at 04:24
  • 1
    Look at this codeigniter uri routes https://www.codeigniter.com/user_guide/general/routing.html#examples –  May 14 '18 at 04:32
  • 1
    @Deepakdev - If your question is how to remove index.php, you should edit your question, since you're not mentioning that once in it. Or better yet, use Google (or CI's manual) since this has been asked and answered more than once already. – M. Eriksson May 14 '18 at 04:42

1 Answers1

0

To call the desired url you have to define a route which will call the desired function when hitting the url. and for removing index.php you have to enable rewrite module in .htaccess or depending on what server you are using.

Nilkamal Gotarne
  • 335
  • 5
  • 16