Magento 2.x. How to Check and Change the Admin Panel URL via CLI or Files

In this tutorial, we will find out how to check your Magento 2 admin URL.
Method 1

The first method is quite simple.

zemez wordpress themes

Open the env.php file you can find under the “app/etc directory in your Magento root folder.

The snippet inside the file will look similar to this one:

'backend' =>
array (
'frontName' => 'admin123',
),
view raw .php hosted with ❤ by GitHub

Where “admin123” is your admin part.

You can adjust the URL and save the file.

Method 2

The second way includes CLI command which needs to be run in your Magento 2 root directory.

The command is as follows:

php bin/magento info:adminuri
view raw .php hosted with ❤ by GitHub

As a result, you will get something like this:

Admin Panel URI: /admin123
view raw .php hosted with ❤ by GitHub

In order to change the URL, run the following command where “admin_path” is your new admin URL.

php bin/magento setup:config:set --backend-frontname="admin_path"
view raw .php hosted with ❤ by GitHub
monster one