follow this
root_folder / .htaccess
remove index.php in url
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]
set base URL
root_folder / application / Config / config.php
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise. | The auto-detection mechanism exists only for convenience during | development and MUST NOT be used in production! | | If you need to allow multiple domains, remember that this file is still | a PHP and you can easily do that on your own. | */ $config['base_url'] = 'http://[::1]/my-project/';
removing index.php in url, even on post request in form
root_folder / application / Config / config.php
$config['index_page'] = '';
set the default controller, mine is "home"
root_folder / application / Config / routes.php
| controller and method URI segments. | | Examples: my-controller/index -> my_controller/index | my-controller/my-method -> my_controller/my_method */ $route['default_controller'] = 'home';
then make sure the controller file name is fully uppercase. also the name of the class.
This is also important when you need to load the server.
root_folder / application / controllers / home.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Home extends MY_Controller { public function index() { } }
then it will be your url
http://[::1]/my-project/home
which is configured even on a real server
it all came from
https://www.codeigniter.com/userguide3/index.html
Lloric Mayuga Garcia
source share