Welcome Guest, Not a member yet? Register   Sign In
Installing CI4.2.10 on Hostinger in a Subdomain
#1
Question 

I have a Hostinger account. I setup a subdomain we'll call "abc". And my main domain we'll call "maindomain.net".
The subdomain is pointed to a subdirectory inside of maindomain.net. The actual path in the shared hosting would be maindomain.net/public_html/abc/

This version of CodeIgniter doesn't seem to have a System folder which I've seen in other threads talking about configuration. I'm curious to know if anyone has some advice on getting this working in the subdomain.

I've tried changing the FC_PATH inside of the public/index.php and no luck.
I'm currently getting a 403 when I try to access abc.mydomain.net.
Any advice?
Reply
#2

If you can alter the location of of the subdomain folder, change it to abc/public instead of abc.
So that abc.maindomain.net forwards to maindomain.net/public_html/abc/public
My hosting party uses the same setup (subdomain pointing to a subfolder) and this is what I had to do to make CI4 work.
Reply
#3

Quote:index.php is no longer in the root of the project! It has been moved inside the public folder, for better security and separation of components.

This means that you should configure your web server to "point" to your project's public folder, and not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter public/..., as the rest of your logic and the framework are exposed.

Please read the user guide for a better explanation of how CI4 works!
https://github.com/codeigniter4/CodeIgni...h-indexphp
Reply
#4

You can also refer to the tutorial here:

CI4 Production Deployment
https://ozar.net/blog/web-development-ph...eployment/

CodeIgniter Wizard (CRUD code generator for Mac) instantly scaffolds Bootstrap-based web applications with an administrative interface (admin templates include Bootstrap5)

Reply
#5

(This post was last modified: 06-12-2023, 05:13 PM by hfr_dev.)

I was able to get the website to load after a few changes mentioned in the blog.

However, I do believe I've hit an .htaccess wall.

I currently have:

RewriteEngine On
RewriteRule ^$ public/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|css|javascript|images|robots\.txt|favicon\.ico)

This will get me to the Home Page with no images loading, no javascript, and no css loading. None of the other pages of the websites are accessible.

I feel like I'm close, just not sure what I'm missing.

I figured it out. I ended up using:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

Thanks everyone that replied! I appreciate the assistance
Reply
#6

When I had my sub domain all I had to do was ftp everything to the sub domain folder and it worked fine.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB