codeigniter – Uploading CodeIgniter4 to Shared Hosting via cPanel

I used Composer to setup CodeIgniter4 in my local PC. And I have completed the development also.

The problem is, am trying to deploy this application to a Shared Hosting that has cPanel.

I have zipped the contents (except the spark and build files) to the /public_html/ folder in my Shared Hosting. Because the primary domain points to this /public_html/ and I can’t change it.

The problem now am facing is, if I access www.mysite.com/public, it loads the site. But won’t load if I access just the domain name www.mysite.com

My directory/file structure is as follows (in the server):

So I basically want the site to be served when I access just the domain. My second question is, from the screenshot I shared, is there any files or folders that is not required to be in the production server?


EDIT:

This is the .htaccess file in /public_html/ that I tried:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php/$1 [L]

https://stackoverflow.com/questions/75855582/uploading-codeigniter4-to-shared-hosting-via-cpanel

Related Posts