How to Change the Admin URL in Magento 2

admin-url-change-file

Update using Magento CLI

Simply run the following command by replacing the admin path with your custom unique path.

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

Update by editing the env.php file

Step 1 

GoTo the file <Magento Root Directory>/app/etc/env.php 

Step 2

Look for the array object that says “frontName” (check the screenshot) and replace “admin” to your new admin URL. Example: admin_qwerty

Step 3

Clear the cache if needed.

Step 4

Try to access the admin using <Site Base URL>/admin_qwerty

Leave a Reply

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