Magento admin url: Effective ways to change it in admin dashboard

Are you still using admin as the administrator path for Magento 2? Then it’s time to change to a unique, custom URL from default ‘admin’ URL. This task is very important for security reasons to prevent hacking/cracking issue. In this article, Magesolution will guide you some effective ways to change Magento admin URL. These methods are really simple to do, so let’s jump right in.

Latest Update:  Magesolution ’ve just released the version 2.0 of Claue Multipurpose Magento 2 Theme, with with a bunch of performance improvements and exclusive features. Check this theme out now: Claue Magento Theme  2. 0 

Why should we change Magento admin URL?

magento-admin-url

While there are many practices recommended for the security of Magento 2 stores, one highly helpful practice is to use a unique path for Magento 2 admin panel URL rather than using the default URL. This will help you avoid determined attackers and decrease exposure to scripts that try to break into your Magento 2 store. However, you should take a note that incorrect URL change can cause Magento login and backend problems.

Any mistakes made during the Magento 2 change of admin URL in the database and the path change can lead to access denial and can be corrected only from the server! Do not try to change the URL unless you know the way to edit configuration files on the server

How to change Admin URL in Magento 2?

As you kown that, the default Magento admin URL is quite predictable and prone to hackers’ attacks. Hence, securing your admin panel is an essential task. Now, Magesolution will show you to do that in 3 ways to change the default admin URL in Magento 2:

  • Change admin URL of Magento 2 in admin dashboard
  • Change The Admin Path In Config.Php
  • Change admin URL  Via a Command Line

The 3 ways work the same way, so select the method that works best for you.

Method 1: Change admin URL of Magento 2 in admin dashboard

This is the easiest way to change admin URL of Magento 2.

Step 1: Login to your Magento 2 admin dashboard and move to Stores > Configuration > Advanced > Admin.Keep in mind to select the scope you need to change admin URL.

Step 2: Expand “Admin Base URL” section and adjust the following values

Untick Use system value for the value you need to changes.

  • In Use Custom Admin URL change the option to Yes to enable using custom admin URL
  • In Custom admin URL, enter the new URL you want to change

If you want to use Custom Admin Path, choose yes in Use Custom Admin Path . Custom Admin path is the text after the last forward slash.

For instance, if you set Custom Admin URL = myadmin and Custom Admin Path = mypath => The final admin URL will be: yourmagento2website.com/myadmin/mypath

After completing , you need to save changes and from now you can access the admin dashboard with your new admin URL.

change-magento-admin-url

Method 2: Change The Admin Path in Config.php

Step 1: Log into your server via ssh using an SSH or FTP client .  Move to the app/etc folder and open env.php file in a text editor.

Step 2: Seeking for the code that says ‘frontName’ and replace the code in the quotes to the right of ‘frontName’ and replace ‘admin’ your new admin URL.

Step 3: Flush Cache.

<?php
return array (
        ‘backend’  =>
        array (
             ‘frontName’ => ‘admin’, 
        ),

Method 3: Change Magento Admin URL via a Command Line

Connect your Magento with an SSH terminal and navigate to the root directory of your Magento 2 website. Now just using the below command:

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

In the command line above, we have set up the admin URL path as magento, and you can set it according to your need. After using your way, you have to clean the cache. To do that, you can use the belowg commands in the Magento 2 root directory.

rm -rf var/cache/*
php bin/magento cache:clean
php bin/magento cache:flush

These are the  simply  3 ways to change the admin URL of your Magento 2 website.
We hope this tutorial was useful for you.  If you have any troubles, please ask them in the comments below. And if you need our professional assistance, feel free to contact us at any time.

Conclusion

Besides, if you are looking out for a cost effective Magento package for your eCommerce store, then look nowhere other than Magesolution. We not only offer an affordable Magento Development Package for all size and budget but also ensure that it helps your online business grow and sustain. Contact us for a free consultation!