How to Change the Admin URL in Magento 2

How to Change the Admin URL in Magento 2

One of the security parts of any store is the login URL of its admin panel. By hiding the admin panel, you can prevent a large number of web attacks that the most important of these is Brute Force Attack.

On the WeGento site, in this part of the Magento 2 tutorial, we will teach you how to change the Admin URL in Magento, so to learn this part you can look at the pictures and read the texts.

Related posts: What is Magento?

The ways to change the admin panel URL in Magento

The first way is using the file (if you know how to code) and the second way is the admin panel.

The first way: Open the app / etc / env.PHP file with an editor like PhpStorm.

How to Change the Admin URL in Magento 2
How to Change the Admin URL in Magento 2

Then change the value of the “front Name” in the specified box to an identifiable value such as mg_mdir. Note Whatever that value is more indistinguishable, it will be hard to find it.

Be careful about the changes that you make in this part because could damage the entire store and not load it.

If you think you may not be able to change this section, please use the second way to change this file. 

The second way to change the admin URL in Magento is:

  • Log in to the Admin Panel.
  • From the admin menu, click on the Stores section
  • Then select the Configuration to enter the admin settings section.
How to Change the Admin URL in Magento 2
How to Change the Admin URL in Magento 2
  • In this step, select Admin from the ADVANCED tab to enter the admin settings.
How to Change the Admin URL in Magento 2
How to Change the Admin URL in Magento 2
  • Click the Admin Base URL tab to open the options in this section.
  • Set the Use Custom Admin URL to yes to open the box for entering the admin address.
  • Custom Admin URL: Enter the admin URL in this box.

Important points to change the admin address in Magento 2 that should be observed

  • Be sure to write the full URL, for example, https://example.com/admin
  • Empty the cache after this change. 
  • After this change, you will be logged out of the admin automatically and you have to log in with the new URL.
  • Remember the admin URL, else you will have trouble finding the URL (You will have to log in to the database and so on.)

The tutorial to change the admin URL is complete, but friends like me, who are constantly faced with the Linux command line (bash), always prefer to change the address with a command. After this we enter the black and magic page.

Two things can be done:

1. Open the app / etc / env.php file with an editor such as Nano or Vim (which is not recommended at all because the skill of working with Vim requires a few training sessions) and change the frontName value.

2. This command causes Change the admin URL in Magento. Of course, I know you know that this command must be run in Magento root.

php bin/magento setup:config:set –backend-frontname=”http://site.com/admin/”

How do I change the admin URL in Magento 2?

There are two ways to change the admin URL in this article. One of them is coding and another way is done through the admin panel setting. If you want to know more study the details in the article “Learn how to change the admin address in Magento” on our Wegento site.

 

How do I find my Magento admin URL?

To find your Magento admin URL in Magento 2:
1- In file app\etc\env.php, search frontName, it will show like this

‘frontName’ => ‘admin’
Your custom Magento Admin Url is located inside of this tag.
Your admin = example.com/admin

What is admin address in Magento?

Magento 2 Admin Panel, also known as Magento 2 backend. It is and URL that by entering in your browser you can access the admin panel. By admin address, you can manage all sections of your online store and make every change that you need.