Changing Your Magento Admin URL for Improved Security

Posted on: 10 Feb 2020 by Admin

In this tutorial we will help you on how to change Magento 2 admin URL
Read carefully and try these steps from your end
Are you still using admin as the administrator path for Magento?
Then it’s time to change to a unique, custom URL from default ‘admin’ URL.
This can help to reduce the exposure of Magento sites from scripts of hackers.
Changing the default admin path is simple for anyone who knows to edit the text in XML files.

Let’s learn on how to change Magento 2 admin URL

We are changing from http://www.ecommercedomain.com/admin to http://www.ecommercedomain.com/newpath.

To change Magento 2 admin URL there are two ways:

Method 1: Change in local.xml

Step 1: Navigate to app/etc/local.xml file under your Magento root directory and edit as given below:

<admin>

  <routers>

    <adminhtml>

      <args>

        <frontname></frontname>

       </args>

     </adminhtml>

  </routers>

</admin>
Replacing admin path with new custom string ‘newpath’:
<admin>

    <routers>

      <adminhtml>

        <args>

          <frontname><!--[CDATA[newpath]]--></frontname>

        </args>

      </adminhtml>

     </routers>

  </admin>

Step 2: Save the file

Step 3: Refresh the Cache from Magento Admin (System -> Cache Management)

Now, you should be able to access admin panel from http://www.ecommercedomain.com/newpath

Method 2: Change from backend settings

This is another easy way to change admin URL from Magento backend admin settings.
Step 1: On the Admin menu, select System > Configure.
Step 2: In the panel on the left, under Advanced, select Admin.
Step 3: Click to expand the Admin Base URL section, and do the following:
3.a. Set Use Custom Admin URL to “Yes.”
3.b. Enter the name of the Custom Admin Path in the following format:
http://www.ecommercedomain.com/newpath
Step 4: When complete, click the Save Config button.
After the changes are saved, you must log in to the Admin using the new Admin URL and path.

We have successfully changed the Magento 2 admin URL.
I hope this tutorial was useful for you. Thanks for reading my blog.