How to Change Admin URL in Magento 2? Detailed Steps to Know

Biztech

By : Biztech

How to Change Admin URL in Magento 2? Detailed Steps to Know1

Summary

Are you still using the default Admin URL for your Magento store? Then, knowingly or unknowingly, you are putting your site to risk.

Nowadays, cyber-attacks are so common that intruders are always on the lookout for vulnerabilities in your site. And leaving the default Admin URL in your Magento 2 store would give them a clear invitation to hack into your store’s admin panel.

In addition, if your passwords are predictable, it gets easier for intruders to invade your site.

So, changing your Magento 2 Admin URL becomes very important. Now, it doesn’t ensure your site will be free from all security vulnerabilities, but it certainly adds an extra layer of security.

Let’s check how to change the default Admin URL in Magento 2 by yourself. You can also hire dedicated Magento developers to ensure complete security of your Magento store.

What is the Default Magento 2 Admin URL?

When you start developing with Magento 2, you will see a default URL with a random string is automatically created. This URL gives access to your store’s backend. The default string or URL typically looks like this:

sitename.com/admin

“OR”

sitename.com/Magento/admin

As you can see, the URL is predictable. Changing the admin URL to a custom and unique name can make it more difficult for hackers to guess the URL.

Therefore, you can reduce the likelihood of your store becoming a target of such attacks. It can also help you protect sensitive information and critical data that are stored in your store’s backend. These data can be customer information, order data, payment details, and so on.

Here, I have presented different ways to change the default Magento 2 URL.

How to Change Admin URL using Magento Admin Panel?


Software-Product-Engineering

Image Source

  1. Firstly, log in to your Magento 2 store admin panel.
  2. Next, go to Stores > Configuration > Advanced > Admin.
  3. Expand the “Admin Base URL” section and set the “Use Custom Admin URL” option to “Yes”.
  4. Click on the “Save Config” button at the top of the page.
  5. Log out of your admin panel now. Try to log back in using the new admin URL.

How to Change Admin URL using Command Line Interface (CLI)?

  1. Connect to your Magento 2 store using SSH.
  2. To do so, run the following command:
    php bin/magento setup:config:set –backend-frontname=”your_custom_url”.
  3. Replace “your_custom_url” with your desired custom admin URL.
  4. Wait for the command to complete and check that the admin URL has been successfully changed.

How to Change Admin URL Using the Database?

  1. Login to your store’s database using phpMyAdmin or any other MySQL client.
  2. Locate the “core_config_data” table and open it.
  3. Search for the “path” column value “admin/url/custom”.
  4. Change the “value” column to your desired custom admin URL.
  5. Click on the “Go” button to save the changes.
  6. Log out of your admin panel and log back in using the new admin URL.

Read Also: How to Optimize Magento Store’s Performance with Hyva Theme Development

How to Change Admin URL using the env.php File?

  1. Log into your server via ssh using an ssh or FTP client (software) (example: Filezilla). Navigate to the app/etc folder and open the env.php file in a text editor.
  2. Look for the code that says ‘frontName’ and replace the code in the quotes to the right of ‘frontName’ and replace ‘admin’ with your new admin URL.
  3. To see the change, you then will need to clear the Magento cache. Flush the cache.


Product-Engineering

Image Source

Note: Before making any changes to your Magento 2 store, it is recommended to back up your store’s files and database. Additionally, changing the Admin URL may impact any integrations or extensions that use the Magento 2 Admin panel.

Therefore, it is important to test the new admin URL thoroughly before implementing it on your live website.

How to Restore the Default Admin URL and Admin Path?

If you have set an invalid Admin URL or Admin Path and lost access to the backend, you can fix this from the command line.

  1. Execute this command to revert to the default Admin URL:
    php bin/magento config:set admin/url/use_custom 0
  2. Execute this command to revert to the default Admin Path.
    php bin/magento config:set admin/url/use_custom_path 0
  3. For clearing the Magento cache
    On the Admin sidebar, go to System > Tools > Cache Management.
  4. Then, click Flush Magento Cache.

Bottomline

Changing Admin Magento 2 default URL is an essential step to add an extra layer of security to your store. It will protect your site from brute-force attacks. With the help of these steps, you should be able to change your default Admin URL to a unique one.

Make sure you replace the default URL with a unique one so intruders can’t predict it. Want to know how you can improve your website’s security further? Connect with a leading Magento development company like BiztechCS to know more and seek the necessary technical assistance!

FAQs

What is the correct URL for MAGENTO admin?

The default URL for Magento Admin is “http://yourdomain.com/magento/admin”. However, the default URLs are susceptible to cyber-attacks. Thus, you have to change it to a unique one.

How to speed up the Magento admin panel in a local host?

There are multiple ways you can optimize the speed of your Magento admin panel. Here are some ways for your reference: 

  • If you have any unused extensions, delete those. 
  • Delete any outdated/ unused products. 
  • Clear cache. 
  • Tune up the database. 
  • Schedule reindexing. 
  • Minimize Javascript and CSS files.

Get a Free Consultation

    ✓ 100% Guaranteed Security of Your Information