Creating an admin url for Magento that is admin.magentostore.com (not /admin)

Creating an admin url for Magento that is admin.magentostore.com (not /admin)

August 22, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Creating an admin url for Magento that is admin.magentostore.com (not /admin)

Simplifying Magento Admin Access via Custom DNS

As an experienced developer at Laravel Company, I often encounter unique challenges when working with e-commerce platforms like Magento. One common request is to restrict admin access to a specific server using custom DNS entries.

The Challenge: Changing the Default Admin URL Structure

By default, Magento uses the /admin path for all admin-related tasks. This structure cannot be changed directly in the core configuration files without modifying core code, which is generally discouraged due to upgrade conflicts and security risks.

The standard admin URL looks like this:

https://magentostore.com/admin

Your goal is to change it to something like this:

https://admin.magentostore.com

The Solution: Using Magento’s Base URLs

Magento provides a flexible way to manage base URLs through the core_config_data table in your database. This allows you to create custom URLs for both frontend and admin areas without touching core files.

Here are the steps to implement this solution:

  1. Create a new entry in the core_config_data table.

You’ll need to insert a new row with the following values:

  • path: web/secure/base_url
  • value: https://admin.magentostore.com/
  1. Clear cache and reindex data.

After updating the database, you must clear all Magento caches and reindex your data for the changes to take effect. You can do this via SSH with commands like:

php bin/magento cache:clean
php bin/magento indexer:reindex

Testing Your New Admin URL

Once the above steps are complete, try accessing your new admin URL in a web browser. It should redirect you to the appropriate server based on your DNS configuration.

Let’s say your primary server has an IP address of 123.456.789.012. If you’ve configured your DNS settings correctly, entering https://admin.magentostore.com in a browser should connect to that IP address and display the Magento admin login screen.

Conclusion: Simplifying Admin Access for Load-Balanced Systems

By leveraging Magento’s custom base URL capabilities along with proper DNS configuration, you can effectively restrict admin access to specific servers while maintaining a clean and secure URL structure.

This approach provides several benefits:

  • Improved Security: Concentrating admin tasks on a single server reduces the attack surface area.
  • Easier Management: Centralizing admin processes simplifies server management and maintenance.
  • Clean URLs: The custom DNS entries provide a professional and intuitive admin URL structure for your team.

Remember, while this method works well for many use cases, it’s important to thoroughly test your setup before deploying it to a production environment. Always have backups ready in case any issues arise during the transition process.

If you’re looking for more advanced Magento customization solutions or need expert guidance on your e-commerce projects, feel free to reach out to the team at Laravel Company. Our experienced developers are always ready to help you overcome complex challenges.

Cache Indexing Database Security

Our network