How to Get admin path Command Line in Magneto 2 through Code

In this tutorial, we will demonstrate how to get admin path command line in Magento 2 which is one of tutorials our in Command Line Series.

Get Admin Path command line

Commands syntax:

php bin/magento info:adminuri

Output:

Admin URI: /admin_mageplaza

So the path is /admin_mageplaza, now navigate your browser to domain.com/admin_mageplaza to access to Magento 2 backend.

Get Admin path in env.php file

Do you know? You can get admin path without access to etc/env.php file.

'backend' =>
  array (
    'frontName' => 'admin_mageplaza',
  ),

Wrap up

That’s how you can get back your admin path command line in Magento 2 in case you have forgotten it.

I hope this is a useful tutorial for you.

Thank you for reading!

Image Description
With over a decade of experience crafting innovative tech solutions for ecommerce businesses built on Magento, Jacker is the mastermind behind our secure and well-functioned extensions. With his expertise in building user-friendly interfaces and robust back-end systems, Mageplaza was able to deliver exceptional Magento solutions and services for over 122K+ customers around the world.
x