Showing results for 
Search instead for 
Did you mean: 

Multisite setup and admin login issue (Magento CE 2.4)

Multisite setup and admin login issue (Magento CE 2.4)

Hello all, 

My current Magento sites are running on CE 2.2.5 at:


I'm in the process of setting up the same in Magento CE 2.4 -- but I'm starting from scratch and will use a new theme and import my catalogs. 


I've been going through and configuring everything manually at , but I'm not sure how to make the multisites work properly (i.e.


I searched around and found some instructions online but so far haven't been successful. I'm not sure if these instructions apply to CE 2.4, nor am I sure of the exact syntax for the copies of index.php in the subfolders.


Here is a look at the index.php file from my Magento root folder: -- I'm aware that I need to replace 'website2' after PARAM_RUN_CODE with the code for the secondary website, but I'm not exactly sure what index.php needs to contain, nor am I finding any instructions that I understand. 


My server is a Cloud Dedicated CentOS 7 64-bit with cPanel from LiquidWeb. In some Magento Docs on the subject I read separate instructions for Apache vs. nginx -- I'm not sure how to check which I'm using but I'm pretty sure I remember tech support mentioning restarting Apache.




To make matters worse, I am no longer able to sign into the admin backend -- every time I try, instead of getting the 2FA prompt after entering username & password, I just get a Logout link, or occasionally this error message: All other open sessions for this account were terminated.


Re: Multisite setup and admin login issue (Magento CE 2.4)

for a multisite setup, you can follow these steps:


  • Create a folder for in the pub folder & point that to
  • copy index.php & .htaccess of pub folder into
    cd magento2_root/pub/
    cp index.php
    cp .htaccess
  • Create symlinks for media & static files 
    ln -s ../media
    ln -s ../static
  • Edit index.php and paste the following code 
     * Public alias for the application entry point
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
    use Magento\Framework\App\Bootstrap;
    use Magento\Framework\App\Filesystem\DirectoryList;
    try {
        require __DIR__ . '/../../app/bootstrap.php';
    } catch (\Exception $e) {
        echo <<<HTML
    <div style="font:12px/1.35em arial, helvetica, sans-serif;">
        <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
            <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
            Autoload error</h3>
    $params = $_SERVER;
    $params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = array_replace_recursive(
        $params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] ?? [],
            DirectoryList::PUB => [DirectoryList::URL_PATH => ''],
            DirectoryList::MEDIA => [DirectoryList::URL_PATH => 'media'],
            DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'],
            DirectoryList::UPLOAD => [DirectoryList::URL_PATH => 'media/upload'],
    $websitecode = "";
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $websitecode;
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
    $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
    /** @var \Magento\Framework\App\Http $app */
    $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
    NOTE: Update website code.
  • update URL for website in-store -> Configuration :: WEB
  • Flush the Magento cache and you are good to go Smiley Happy 
    php bin/magento cache:flush

kindly Accept as a Solution if this works for you and give kudos Smiley Happy 

Re: Multisite setup and admin login issue (Magento CE 2.4)

Hello Amitsamsukha,

Thanks very much for your reply and your help. I followed your instructions carefully for the first store:   (will this URL structure also work?)


(Note for any other beginners trying to follow his instructions: before creating the symlinks, you need to cd into the new folder you create)


So far, after flushing the magento cache, I am still not able to load


Any idea if I could be missing a step somehow?


best, Peter

Re: Multisite setup and admin login issue (Magento CE 2.4)

you have to point to Magento's pub folder for 

then Flush the cache 

php bin/magento cache:flush


Re: Multisite setup and admin login issue (Magento CE 2.4)

Hmm, I followed those instructions, but it still did not work.


What's strange is that in my previous instance of Magento (2.2.5) I have this configuration:


So I've entered the same for 2.4:


What is different is that the Default Config in 2.4 is different:

...and if I change the Base URLs for Static & Media files, the icons in the admin backend no longer appear.

So maybe I have the wrong path somehow?