The first step is to open the app.app file. And the changes mentioned below. You have to do this in your App.php file. remove index.php from url Codeigniter.
So go to **project_name/app/Config/App.php** and change mention below: [***How To Remove Public/index.php/ From URL In Codeigniter 4***][1]
public $baseURL = 'http://localhost:8080';
To
public $baseURL = 'http://localhost/your_project_name/';
And the second change in the app.php file:
public $uriProtocol = 'REQUEST_URI';
To
public $uriProtocol = 'PATH_INFO';
**Step: 2**
In the root project directory, open index.php and edit the following line:
$pathsPath = FCPATH . '../app/Config/Paths.php';
change TO
$pathsPath = FCPATH . 'app/Config/Paths.php';
**We can also remove index.php in Codeigniter using .htaccess. I have given the example below.**
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
[1]: https://www.phpcodingstuff.com/blog/how-to-remove-publicindexphp-from-url-in-codeigniter-4.html
Try the following
Open config.php and do following replaces
$config['index_page'] = "index.php"
to
$config['index_page'] = ""
In some cases the default setting for `uri_protocol` does not work properly.
Just replace
$config['uri_protocol'] ="AUTO"
by
$config['uri_protocol'] = "REQUEST_URI"
**.htaccess**
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Note: .htaccess code vary depending on hosting server. In some hosting server (e.g.: Godaddy) need to use an extra ? in the last line of above code. The following line will be replaced with last line in applicable case:
// Replace last .htaccess line with this line
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]