Skip to main content
Magento 2

How to Change Magento 2 Admin URL?

Learn how to change the Magento 2 admin URL for improved security. Step-by-step guide to customize your login URL.

How to Change Magento 2 Admin URL?

Changing your Magento 2 admin URL is one of the most important security measures you can take. By default, your admin panel is accessible at /admin/, which makes it vulnerable to brute force attacks.

Why Change Your Admin URL?

The default Magento 2 admin URL is well-known to hackers and bots. By changing it to a custom URL, you make your store much more secure against automated attacks.

How to Change Magento 2 Admin URL

There are two methods to change your admin URL in Magento 2:

Method 1: Using the Admin Panel

  • Login to your Magento 2 Admin panel
  • Go to Stores > Configuration > Advanced > Admin
  • Expand the “Admin Base URL” section
  • Enter your new custom admin URL in the “Custom Admin URL” field
  • Click Save Config

Method 2: Using the Command Line

You can also change the admin URL using the Magento CLI with the following command:

Code implementation available in the full documentation.

Important Notes

  • Make sure to save your new admin URL somewhere safe
  • Clear your browser cache after making changes
  • Keep backups of your configuration
  • Test the new URL before notifying your team

Troubleshooting

If you’re locked out after changing the URL, you can reset it using the command line or database configuration.

Need help with this?

Get managed Magento hosting tuned for performance.

Learn more