How to remove index.php from the URL?

1. Update in the App.php file

We need to change baseURLindexPage, and uriProtocol variables in the /app/Config/App.php file. You can refer to the below changes.

ThenAfter
public $baseURL = 'http://localhost:8080';public $baseURL = 'http://localhost/your_project/';
public $indexPage = 'index.php';public $indexPage = '';
public $uriProtocol = 'REQUEST_URI';public $uriProtocol = 'PATH_INFO';

2. Copy index.php and .htaccess files

Copy the index.php and .htaccess files file from the public directory and paste them into your project directory.

3. Update In the index.php

Open the index.php file and change the pathsPath variable.

ThenAfter
$pathsPath = FCPATH . '../app/Config/Paths.php';$pathsPath = FCPATH . 'app/Config/Paths.php';