Welcome Guest, Not a member yet? Register   Sign In
Dynamic $baseURL for multiple hosts
#1

(This post was last modified: 08-26-2020, 11:04 PM by jreklund.)

I am developing an app that will have multiple domains and subdomains pointed at it.  I would like to have CodeIgniter automatically detect the Base URL.

In Config/App.php it says this:

PHP Code:
    /*
    |--------------------------------------------------------------------------
    | Base Site URL
    |--------------------------------------------------------------------------
    |
    | URL to your CodeIgniter root. Typically this will be your base URL,
    | WITH a trailing slash:
    |
    |    http://example.com/
    |
    | If this is not set then CodeIgniter will try guess the protocol, domain
    | and path to your installation. However, you should always configure this
    | explicitly and never rely on auto-guessing, especially in production
    | environments.
    |
    */ 

I also have this line commented out in my .env file:
Code:
# app.baseURL = ''


I am receiving this error:

You have an empty or invalid base URL. The baseURL value must be set in Config\App.php, or through the .env file.

How can I dynamically set the Base Site URL to use for multiple sites pointing to the app?
Reply


Messages In This Thread
Dynamic $baseURL for multiple hosts - by muncherelli - 08-26-2020, 08:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB