Welcome Guest, Not a member yet? Register   Sign In
Using Subdomains for multiple apps
#1

Has anyone setup or know how you would setup your folders to share 1 codeigniter install for multiple apps using subdomains. Lets say I want to use site1.domain.com and site2.domain.com as my public folders which contain the index.php files.

site1.domain.com
   -index.php
site2.domain.com
  -index.php

where should the app, writable and testable folders sit?
Where should the system folder sit?

Any suggestions?
Reply
#2

(This post was last modified: 03-26-2020, 10:41 AM by jreklund.)

Personally I don't have multiple index.php files, I change the url and settings with environment variables from Nginx/Apache. But that means you need to have a "real" server and not using shared hosting.

If that's not possible just place it one level up
codeigniter4
-app
-...
site1.domain.com
-index.php
site2.domain.com
-index.php
Reply
#3

I have done this and it work:

1. The server should use 1 folder which have 1 subfolder for each subdomain. I apply shared hosting which support this.

2. Here the structure:
-site1
--app
--public
---index.php
-site2
--app
--public
---index.php
-system
-writable

3. Edit the path for accordingly on app/config/paths.php for both site1 and site2. You can copy one to another.
Also edit pathspath line on public/index.php. both on site1 and site2
4. Point site1.domain.test to folder site1/public/index.php also on site2 accordingly. This should be supported on the eserver
Reply




Theme © iAndrew 2016 - Forum software by © MyBB