Bookmark

How to Locate the Admin URI in Magento 2

How to Locate the Admin URI in Magento 2

Identifying the precise admin path in Magento 2 is key for smooth store management, especially when it has been customized for security reasons. Magento 2 includes a built-in command that allows you to quickly and easily retrieve this path. Alternatively, you can also check the env.php file for this information if needed.

Method 1: Using the info:adminuri Command

Magento 2 provides a straightforward CLI command to retrieve the admin URI. This method is highly recommended for its simplicity and accuracy.

Steps:

  1. Navigate to the Magento 2 Root Directory:
  2. cd /path/to/your/magento2/root
  3. Run the Command:
  4. php bin/magento info:adminuri
  5. Review the Output:
  6. The command will return the admin URI:

    Admin URI: /admin_custom_path

    If no customization exists, it will display:

    Admin URI: /admin

Method 2: Checking the env.php File

Though less common, you can also find the admin path in the env.php file if it has been explicitly set.

Steps:

  1. Locate the env.php File:
  2. /path/to/your/magento2/root/app/etc/env.php
  3. Examine the File:
  4. Open the env.php file and look for the admin path setting:

    <?php
    return [
        'backend' => [
            'frontName' => 'admin_custom_path'
        ],
        // other configurations
    ];
    ?>

    If the 'frontName' key is not present, the default admin path is used (/admin).

Post a Comment

Post a Comment