Home Tutorials CodeIgniter Tutorial Removing public and index.php from URL in Codeigniter-4

Removing public and index.php from URL in Codeigniter-4

51
0
How to Remove index.php from URL in Codeigniter 4

Step 1: Open App.php File from the Location: c:/xampp/htdocs/your_project_name/app/Config/App.php

public $baseURL = 'http://localhost:8080';

   To

public $baseURL = 'http://localhost/your_project_name/';

Step2:

public $uriProtocol = 'REQUEST_URI';

  To 

public $uriProtocol = 'PATH_INFO';

Step3:

In public/ directory, copy index.php and .htaccess to your root project directory.

Step4: Open index.php from project root directory,  and edit the following path:

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

  To

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

if its doen’t work also change the name in directory of App/Config/App.php file from

Step 1: Open App.php File from the Location: c:/xampp/htdocs/your_project_name/app/Config/App.php

public $indexPage = 'index.php';

  To

public $indexPage = '';

LEAVE A REPLY

Please enter your comment!
Please enter your name here