Why the strange string?
Whenever you install Magento 2, Magento would automatically create an admin URL with random string appended to it at the end.It does this for the simple fact that you’re critically exposed to threats & brute force attacks if you keep an easy and guessable admin panel URL.Using a complex Admin Panel URL is highly recommended, since it makes it difficult for hackers to even find your Admin Panel Login page in the first place; leave alone penetrate into your admin panel.
Why change it?
When it comes to the development process, we won’tneed such a sophisticated URL unless we are hosting our development environment in a public domain that is accessible to all (which is most often, not the case).Once the development process completes and we proceed to migrate our site to a live environment, we’d need to change the Admin Panel URL to a more complex one to ensure enhanced security.
So in simple terms, it wouldn’t be advisable to mess with the secure URL if your store is publically visible. For development purposes, you can go ahead and change it.
3 ways to change the Admin Panel URL
1. Changing the admin path in Config.php
After Magento 2 is successfully installed, the admin URL will get saved in an environment configuration file called as env.php located in the following path:
The file looks like this:
You can change the admin path by modifying the value against‘frontName’.
2. Using Magento 2 Command Line
Open the terminal or command prompt and navigate to the directory in which the Magento 2 is installed. Enter the following command to change the Admin panel URL:
php bin/magentosetup:config:set --backend-frontname="myadmin"
3. Using admin panel configuration
Lastly, this the easiest and simplest option to change the admin panel URL.
- Login to the Magento 2 admin panel URL and navigate to Stores ->Configuration.
- Under the Advanced section, click on the Admin menu item.
- Expand the Admin Base URL section and set the value of the Use Custom Admin Path to Yes.
- Use the Custom Admin Path text field to specify the custom admin ‘frontname’and save the configuration.
Did this tutorial help you? Let us know in the comments! Do you have any other questions? Reach out to us for everything Magento and we’ll be more than glad to assist! We have an awesome team of expert Magento developers who have hands-on experience in Magento 1 as well as Magento 2. So if you have a Magento online store that needs customizations or quick-fixes, call us at +1 516 717 2049 or fill this form to instantly hire a developer.
We also have a great Magento Extensions Store @ store.velanapps.com. Visit our magento extensions store and find the perfect extension for your Magento Online Store! If you can’t find an extension or want to request for one, use this contact form.