Welcome Guest, Not a member yet? Register   Sign In
codeigniter4 in public hosting problem
#1

(This post was last modified: 09-17-2021, 04:19 AM by dgvirtual.)

Hi, I have installed my codeigniter4 app on the production server (shared hosting). However, all I can access is the home page (which does look fine); if I try to access any of the other pages I get a 404 error - what is worse, it is not even the CI4 error page (it is default apache 404 page).
The public folder on the server is this:
Code:
/home/myid/domains/mydomain.lt/public_html/

So, my ci installation (app/, vendor/, .env ...) is located here:
Code:
home/myid/domains/mydomain.lt/myapp/
the index.php is here:
Code:
/home/myid/domains/mydomain.lt/public_html/index.php
I have modified the path in '.env' file:
Code:
app.baseURL = 'https://mydomain.lt/'
database.default.database = '../myapp/writable/myapp.sqlite3'
and I have modified the index.php part from:
Code:
$pathsConfig = FCPATH . '../app/Config/Paths.php';
to:
Code:
$pathsConfig = FCPATH . '../myapp/app/Config/Paths.php';
Am I missing something? Or is it some problem on the server side?
I know the home controller is run when I access the home page at https://mydomain.lt/  (I see the website homepage), and I know the database can be accessed because I can see the data output through the default method of the default controller (Home.php). But if I try to access that same controller by name - https://mydomain.lt/home/ -  I get a default apache 404 error.
How do I troubleshoot that?

(09-17-2021, 04:04 AM)dgvirtual Wrote: Hi, I have installed my codeigniter4 app on the production server (shared hosting). 
Feel a complete idiot... I was missing .htaccess file in the public folder - failed to copy it somehow from my dev environment. Sorry for the bother, but I am leaving it here for others to learn.
==

Donatas G.
Reply
#2

(09-17-2021, 04:04 AM)dgvirtual Wrote: Feel a complete idiot... I was missing .htaccess file in the public folder - failed to copy it somehow from my dev environment. Sorry for the bother, but I am leaving it here for others to learn.

Glad you got it working and thanks for reporting back with your solution. Cool
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB