CodeIgniter Forums
multiple domein/subdomein - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: multiple domein/subdomein (/showthread.php?tid=80544)



multiple domein/subdomein - Secux - 11-14-2021

How do I configure my app to work with both domain and subdomains (websites.com, sub.website.com)?

base_url and CORS

I only managed the sessions to configure


RE: multiple domein/subdomein - captain-sensible - 11-15-2021

the basics are with a domain , your hosting directory is the equivalent of "public" within the CI4 structure. So your hosting http directory with contain all thats within the public directory and everything else budle into another directory (with name of your choice) at a level, one above your public one.

Then via index.php in your main hosting directory, you point to the directory containing everything else via eg

Code:
//$pathsPath = realpath(FCPATH . '../CI4/app/Config/Paths.php');

here ../ means one directory up
CI4 is the name i gave to the directory containing everything EXCEPT the public directory of a CI4 app structure



I have a web using sub-domain. The way the hosting is set up for me is that within my main hosting space I have sub-directories with appropriate names. via cpanel i first set up /activate my domain name; then in cpanel there is "add domain" and "sub domain" i set that up , then i edit sub-domain so that system is listening to the public directory of the sub -domain.



also for dev on local host , you do something similar for sub domains - im on Arch my apache is at :


/srv/http

in http i have several directories ; i can serve the landing page for any of the apps in the sub directories by setting up virual hosts