skip to Main Content

I have a running store on Magento 2 which has multiple websites that I can access in the front end without any problems, for example:

https://siteone.mymagestore.com
https://sitetwo.mymagestore.com
https://sitethree.mymagestore.com
.
.
.

But when I try to access the admin panel in the same way it redirects me to the main store URL, for example:

https://siteone.mymagestore.com/admin -> Redirects to https://www.mymagestore.com/admin

How can I allow accessing the Magento admin panel on URLs like https://siteone.mymagestore.com/admin as well?

I have tried many aspects to solve the problem but nothing seems to help. Any help on it would be highly appreciated.

2

Answers


  1. Chosen as BEST ANSWER

    This can be done by changing adding the following code in MagentoFrameworkUrl

    getUrl() function - At the end add

    Replace:

    $this->cacheUrl[$cacheKey];
    

    With:

    $finalUrlArray = explode('://', $this->cacheUrl[$cacheKey]);
    $finalUrl = $finalUrlArray[0].'siteone.'.$finalUrlArray[1];
    return $finalUrl;
    

  2. Unfortunately, that’s not possible only with Magento at this moment. Magento allows you to specify a custom admin URI (For having your shop on siteX.magestore.com, and the admin on admin.magestore.com for example).

    If you need more information, you can check this issue on magento github. This is a incorrect behavior on Magento reported two years ago, confirmed on 2.1, 2.2, 2.3 and not fixed yet.

    As a workaround, on the bug report I’ve found this:

    This module fixed it for us: METMEER/magento2-multi-store-fix!

    You can try to install this module.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search