How to Change Admin URL in Magento 2

Magento 2 is widely used CMS for E-commerce stores. Security, which is of prime importance, is given utmost priority in the CMS. Here, I’ll discuss one of the ways to implement security in the store, i.e., change admin URL in Magento 2.

The admin URL is used to access the backend of the store. It allows editing as well as manage the administrative tasks. However, the default format of the URL, “sitename.com/admin” is vulnerable to bots. It is easy to crack the predictable names such as a backend, admin, etc.

It is good practice to have a unique name of the admin URL that’ll help protect the backend admin from automated software’s hacks or bots attack. Experts recommend to change admin URL in Magento 2, hence I’ve come up with the method for the same!

Methods to Change Admin URL in Magento 2:

There are 3 methods to set custom Magento 2 admin URL:

  1. via SSH

    Run this command:

    Here set whatever URL you wish to set in place of “admin_path“.

  2. Manually

    • Navigate to app/etc/env.php
    • Change ‘frontName’ => ‘admin’,
    • Clear cache
  3. via Admin panel

    • Log in the Admin panel
    • Navigate to Stores > Configuration
    • Click on Admin under Advanced section.
    • Under Advanced, click Admin and expand the Admin Base URL section.
    • Set Use Custom Admin URL to “Yes”.
    • Enter the custom admin URL
    • Also, you can enable the “Use Custom Admin Path” field and just set the custom admin path instead of the entire URL. This is an alternate method.
    • You will be logged out and redirected to the new Admin URL.

Change-backend-URL-from-admin-panel

These methods are handy to set custom admin URL in Magento 2. Though the method does not guarantee 100% security from bots, it does contribute to your efforts to secure the admin panel.
After using one of the methods to change the admin URL in Magento 2, you can type the new admin URL and log in as usual. Apart from securing the Magento 2 store against bots and attackers, changing your default admin URL is the tiny step towards the larger security endeavor.

For similar solution in Magento 1, check here.

Comment below if you face any issues in the implementation.

Enjoy secure Magento 2 store ?️

5
(based on 13 Reviews)
How to Change Admin URL in Magento 2Author Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

2 Comments

Leave a Reply

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