简体   繁体   English

在子域上访问Magento管理员

[英]Access Magento Admin on Subdomain

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: 我在Magento 2上有一家正在运行的商店,该商店有多个网站,可以在前端毫无问题地访问它们,例如:

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 https://siteone.mymagestore.com/admin- >重定向到https://www.mymagestore.com/admin

How can I allow accessing the Magento admin panel on URLs like https://siteone.mymagestore.com/admin as well? 如何允许我访问https://siteone.mymagestore.com/admin之类的 URL上的Magento管理面板?

I have tried many aspects to solve the problem but nothing seems to help. 我已经尝试了许多方面来解决该问题,但似乎无济于事。 Any help on it would be highly appreciated. 任何帮助将不胜感激。

Unfortunately, that's not possible only with Magento at this moment. 不幸的是,目前这仅适用于Magento。 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). Magento允许您指定自定义管理URI(例如,用于在siteX.magestore.com上开店,例如在admin.magestore.com上开店)。

If you need more information, you can check this issue on magento github . 如果您需要更多信息,可以在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. 这是两年前在Magento上报告的错误行为,已在2.1、2.2、2.3上得到确认,但尚未修复。

As a workaround, on the bug report I've found this: 作为一种解决方法,在错误报告中,我发现了这一点:

This module fixed it for us: METMEER/magento2-multi-store-fix! 该模块为我们修复了该问题:METMEER / magento2-multi-store-fix!

You can try to install this module. 您可以尝试安装此模块。

This can be done by changing adding the following code in Magento\\Framework\\Url 这可以通过更改以下内容来完成:在Magento \\ Framework \\ Url中添加以下代码

getUrl() function - At the end add getUrl()函数-最后添加

Replace: 更换:

$this->cacheUrl[$cacheKey];

With: 附:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM