CodeIgniter Framework
Codeigniter 4 Tweak: How to Remove public & index.php from browser for better SEO
July 27, 2021
0
, , ,

CodeIgniter4 framework-based site page needs to browse using the public by default.

If you want to remove that public from the URL & also if you want to remove index.php from URL, do the following things:

Step 1:

Copy public folder index.php & .htaccess to the root folder

Step 2:

Then in the root index.php (that was just copied), change the modification:
$pathsConfig = FCPATH . ‘../app/Config/Paths.php’;

To
$pathsConfig = FCPATH . ‘app/Config/Paths.php’;

Step 3:

Then in the app/Config/App.php,

find
public $baseURL = ‘https://arzerin.com/public/’;
to
public $baseURL = ‘https://arzerin.com/’;

————————

find
public $indexPage = ‘index.php’;
To
public $indexPage = ”;


WoW, you are done.

For Quick Learn Watch the Video:

About author

ZERIN

CEO & Founder (BdBooking.com - Online Hotel Booking System), CEO & Founder (TaskGum.com - Task Managment Software), CEO & Founder (InnKeyPro.com - Hotel ERP), Software Engineer & Solution Architect

How do i install older version of CI4 using composer

Sometimes when you run git update & composer u...

Read more

Severity: Warning Message: Cannot modify header information – headers already sent by

Suddenly I am getting the below error message in m...

Read more

CodeIgniter: How To Call A Controller from another Controller

Suppose you have two controllers file, one is user...

Read more

There are 0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *