Create an admin url for Magento, which is admin.magentostore.com (not / admin)

I use several load-balanced servers and have the requirement that all of my administrative tasks be allocated to a single server. We have determined that the best way to do this is with a DNS record for the administrator. to point to our main server.

The problem I see is that all user urls are still magentostore.com/admin, while I need admin.magentostore.com.

Any ideas or did anyone do something similar?

Thank!

+3
source share
3 answers

, !

:

  • url admin, /admin URL-. url admin http://admin.yourdomain.com, - url (, http://yourdomain.com). config.xml. core_config_data, : web/secure/base_url web/unsecure/base_url.

    <config>
         <default>
             <admin>
                 <web>
                     <unsecure> <!-- defining HTTP url options for admin store -->
                         <base_url>http://admin.yourdomain.com/</base_url>
                     </unsecure>
                     <secure> <!-- defining HTTPS url options for admin store -->
                         <base_url>https://admin.yourdomain.com/</base_url>
                     </secure>
                 </web>
             </admin>
         </default>
         <websites>
             <website_code1>
                 <web>
                     <unsecure> <!-- defining HTTP url options for admin store -->
                         <base_url>http://yourdomain1.com/</base_url>
                     </unsecure>
                     <secure> <!-- defining HTTPS url options for admin store -->
                         <base_url>https://yourdomain1.com/</base_url>
                     </secure>
                 </web>
             </website_code1>
             <website_code2>
                 <web>
                     <unsecure> <!-- defining HTTP url options for admin store -->
                         <base_url>http://yourdomain1.com/</base_url>
                     </unsecure>
                     <secure> <!-- defining HTTPS url options for admin store -->
                         <base_url>https://yourdomain1.com/</base_url>
                     </secure>
                 </web>
             </website_code2>
         </websites>
    </config>
    
  • .htaccess Magento, /admin/request, . , :

    SetEnvIf Host ^admin\.yourdomain\.com$ MAGE_RUN_CODE=admin
    RewriteEngine On
    RewriteCond %{HTTP:HOST} ^admin\.yourdomain\.com$
    RewriteCond %{REQUEST_URI} !/admin/
    RewriteRule .* %{REQUEST_URI}index.php/admin/ [R=302,L]
    
+5

.htaccess, admin.magentostore.com index.php/admin. Apache rewrite, , . Magento , .htaccess .

, JD

+2

System > Configuration > Admin > Admin Base URL. http://admin.magentostore.com/. MAGE_RUN_CODE, , .

( ) , URL-. , , admin, , , , ...

0

Source: https://habr.com/ru/post/1772998/


All Articles