follow this
root_folder/.htaccess
to 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 script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://[::1]/my-project/';
removing index.php
in url, even on request post in form
root_folder/application/config/config.php
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
set 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';
after that, make sure that the all controller file name is capitalize.
also a class name.
this is also important mostly when you need to upload in a live
server.
root_folder/application/controllers/Home.php
<?php
/**
*
*
* @author Lloric Garcia <emorickfighter@gmail.com>
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Home extends MY_Controller {
public function index() {
}
}
then this will be you url
http://[::1]/my-project/home
that is my set up even in live server
all of this came from
https://www.codeigniter.com/userguide3/index.html