Magento 2 Admin URL
Magento 2

Magento 2 Admin URL

November 18, 2017

A lot of things changed in Magento 2, also some of it’s core feature too. For example Magento 2 Admin URL address. Each Magento 2 installation instance in fact generate a random Magento 2 Admin URL. The goal is to minimize the exposure to bots that want to gain unauthorized access to Magneto 2 Admin is minimized. In this post I will cover how to retrieve and how to change Magento 2 Admin URL.

Change Magento 2 Admin URL





How to retrieve Magento 2 Admin URL

In case you forgot your Magento 2 Admin URL, you can retrieve it by using the Magento 2 CLI. The following Magento 2 CLI command will give you the wanted information:

php bin/magento info:adminuri

Example of the result:

Admin Panel URI: /admin_test

You can also retrieve the the Admin URL in <your Magento install dir>/app/etc/env.php. Example:

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

 

How to change Magento 2 Admin URL

To change the randomly generated Magento 2 Admin URL, you can again use Magento 2 CLI or through Magento 2 Admin settings.

Using Magento 2 CLI

. The following command is here to help you:

php bin/magento setup:config:set --backend-frontname="newadminpath"

The system will ask you for the confirmation to overwrite the existing configuration for the backed-frontname. <

Overwrite the existing configuration for backend-frontname?[Y/n]

Just confirm with “Y”.

Y

The response should be something like that

You saved the new configuration.

Attention, be careful at choosing the new URL. Otherwise all the effort of the Magento 2 community at making this URL unique will vanish into darkness. Try to avoid common paths like admin, administration and backoffice.

Using Magento 2 Admin settings

If you are not a command line guy, you can also use the web interface to change the Magento 2 Admin URL. Here are the required steps:

  1. Log in the Magento 2 Admin interface
  2. Click Stores
  3. Click Configurations
  4. In the panel on the left, under Advanced, click Admin and expand the Admin Base URL section
  5. Set Use Custom Admin Path to “Yes”.
  6. Enter the Custom Admin Path. The path that you enter is appended to the Custom Admin URL after the last forward slash. For example: testadmin
  7. You will be logged out and redirected to the new Admin URL

Change Magento 2 Admin URL through config

 

Fun fact:

Haven’t you tried Magento 2 on Docker yet? Check out my blog post Docker Magento 2 about it.

0

Follow deanpodgornik on

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *