Welcome Guest, Not a member yet? Register   Sign In
Removing the index.php file - 11.09.2018
#1

Hello guys!

i did all the settings described hier!

First i created the .htaccess following this article
https://github.com/bcit-ci/CodeIgniter/w...or-Windows

Second
config.php

$config['base_url'] = 'http://localhost:50111/ci/';
$config['index_page'] = '';

routes.php

$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';

Class
Pages.php

class Pages extends CI_Controller {

        public function view($page = 'home') // First METHODE view
     {
        if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php'))
        {
                // Whoops, we don't have a page for that!
                show_404();
        }

        $data['title'] = ucfirst($page); // Capitalize the first letter

        $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);
    }

The result that i got is this:

http://localhost:50111/ci/index.php/news
http://localhost:50111/ci/index.php/pages/view

If i remove the index.php i got a error page.

I restarted the server a couple of times and nothing happens. Does someone has a suggestion please?

Thank you in advance!
Reply


Messages In This Thread
Removing the index.php file - 11.09.2018 - by Porto - 09-11-2018, 07:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB