how to change admin URL in Magento 2

Magento 2 Admin URL: How to set a custom Admin URL

An Admin URL varies with every new platform installation. Once installed, the admin URL and path are below the Magento 2 base URL:

Default Base URL:
Default Admin URL and Path:

Magento 2 Admin URL change

¡Address your hosting provider before changing the default URL, as some hosting services require a standard URL to conform to the firewall protection rules! 

There are two main ways you can set a custom Admin URL for your store: 

#1 via the Admin Panel

  • Log in to the Admin Panel, choose Stores>Settings>Configuration;
  • Navigate to the Advanced settings and select Admin;
  • Expand the Admin Base URL section and make the next settings:
  • In this case, you will have URL. If you want to change only the path, make changes in the Custom Admin Path section and leave the Use Custom Admin URL option set to 'No';
  • The Admin URL must be in the same Magento installation and have the same document root as the front end of the store!
  • Once it’s made, click the Save Config button and clear the cache.

#2 via the Server Text Manager

  • Open the app/etc/env.php file in a text manager and change the name of the [admin] path. The admin path is located in the app/etc/env.php file. Look for ‘backend’ using the commands: 


    'backend' => array ( 'frontName' => 'admin')
    'backend' => array ( 'frontName' => ‘backend’)

Don’t forget to use the lowercase characters only and save the changes.

  • Enter to the Admin panel to clear the Magento cache: System> Cache Management> Flush Magento Cache;
  • Return to the server, go to the var/cache folder and delete its content.

Viewed 436 Times

Post On 2022-12-05