Learn Magento 2

One of the most used Opensource E-Commerce Platform build on Enterprise level!

• Last Updated: 01/10/2020
• ( 5 minutes reading )

How to configure Custom Admin URL in Magento 2

Introduction

The Admin Base URL is the URL you use to access your Magento Admin Dashboard. Depending on how Magento is installed that may vary, however, usually, it is something like yourdomain.com/admin123/. The main purpose of using a Custom URL is due to security reasons - as a preventive measurement for brute-force attacks, hacker attacks, and other threats. We will introduce two ways of changing the Admin Base URL in Magento.

Before you step further to making any sort of changes we will strongly advise you to ensure you have a backup copy of your website’s files and database. Also, please note that is recommended to perform such changes in a development environment rather than live websites.

 

Changing the Admin URL via Magento Admin

The very first step we will need you to take is to log in to your Magento Admin Dashboard and navigate through the left menu bar to Stores > Configuration.

 

Accessing the Configuration page

 

Once you access the “Configuration” page, please expand the last “Advanced” section and click on “Admin”.

 

Accessing the Admin page

 

Once you are at the “Admin” settings page, please expand the “Admin Base URL” section. 

Please make sure to leave the first “Use Custom Admin URL” set to “No”.

You will have to untick the “Use System Value” checkbox next to “Use Custom Admin Path” and select “Yes” from the dropdown menu. Then you will be presented with an additional “Custom Admin Path” field where you will need to enter the desired path for your Admin URL.

In our example, we have entered “customurl” which will change the default http://domain.com/admin123/ to http:domain.com/customurl/. We believe you can come up with something more creative and secrete than that.

 

Adding the custom path

 

Once you enter the desired path, please click on the “Save Config” button. Afterward, you will be automatically logged out and redirected to your new Admin Login page.

 

Confirming the Admin URL

 

And that is it! You have your new Magento Admin URL successfully configured.

 

Changing the Admin URL by editing the env.php file

You can change your Magento Admin Login URL by editing the “env.php” file. The file can be edited either through the “File Manager” available in your cPanel account, via FTP, or via SSH. No matter which method will be used, you will achieve the same result, therefore, you are welcome to choose the most convenient method for you.

From your Magento root directory, please navigate to the app/etc folder and you will locate the “env.php” file. Please, open the file with a text editor and you will see the following code.

 

Editing the env.php file

 

Please, change the text in the single brackets positioned after “'frontName' =>” to your desired one. For example:

 

Example env.php file

 

After you perform the change, please do not forget to save the file. Once you successfully save the file, please make sure to flush Magento’s cache by going to System > Cache Management > Flush Magento Cache.

 

That is it - pretty straight forward, right? We hope you have found our tutorial easy to follow and you have managed to successfully configure your Custom Admin Login URL. As usual, we would like to thank you for trusting our guidance and encourage you to contact our Support Team in case any further instructions are needed.

 

...
Sebahat
Content Marketing Specialist

Sebahat is a young and bright woman who has become an invaluable part of our team. She started as a Customer Care Representative, mastering that role and, along the way, growing into a tech-savvy individual who is well acquainted with every support layer of the company. Driven by her aim to improve our customers’ experience constantly, she is committed to enhancing the extraordinary support we deliver.