May 18, 2023
How to change your domain name for Magento 2

If you are rebranding your store or changing products, then a domain name change may be in the cards for you. Keep reading to learn how to change your domain name in Magento 2.

What is Magento 2?

Magento 2 is a powerful ecommerce platform. As of April 2023, it powers about 8% of all ecommerce sites. Though intended for medium-to-large online stores, Magento 2 is a great platform for SMB owners who desire out-of-the-box integration with PayPay and Authorize.net, as well as hard-driving SMB owners with an eye toward quickly scaling their shops.

Get fully managed Magento hosting

Accelerate your store's potential, without the tedious maintenance

Why should you change your domain name?

There are a number of reasons why you may want to change your domain name on Magento.

1. Business name change

Whether you want a name change to reflect a change in your business focus or a court has ruled that you’re infringing on a trademark, sometimes you need to change your business name. If you change the name of your business, it can often make sense to update your domain name to reflect that change.

Example: The Worldwide Wrestling Federation decided to change its name following the 2002 court ruling that it could no longer use the initials “WWF” (and, thus, no longer allowed to use the domain name, wwf.com).

2. gTLD or subdomain changes

Although your gTLD has no impact on your Google Search rankings, your customers may find a .com top-level domain name easier to remember than a .store top-level domain. Similarly, a bare domain or a www subdomain might be easier for your customers to remember.

Additionally, consistent site-wide usage of a bare subdomain or a www subdomain may simplify your backend use of website cookies.

Example: www.cookiesbyolivia.com and oliviasonthird.com are both easier to remember than are web.cookiesbyolivia.com and store.oliviasonthird.com.

3. Production deployment

Some developers like to develop and stage sites under a domain name other than the domain name that will be used in production. When deploying the production site, it is important to remember to change the domain name in Magento 2.

Example: A developer might build and test a store using the URL olivia.magentostaging.com. They might change the domain name in Magento 2 to oliviasonthird.com when deploying the site in production mode.

Learn how to register your domain name here.

Steps to changing the domain name in Magento 2

Changing the domain name in Magento 2 is as simple as updating the base URLs.

The directions below are for changing the domain name in a single-store Magento 2 site using the Admin Dashboard. You can also change the domain using the command line or phpMyAdmin.

1. Go to the main menu of your Admin Dashboard

Go to the main menu of your Admin Dashboard and then select Stores and Configuration

2. Go to the navigation menu

Select the Web tab.

Go to the navigation menu and select the Web tab

3. Open the Base URLs submenu

Open it by clicking the down arrow.

4. Update the Base URL field

Update the value by changing your old domain name to the new domain name.

Update the Base URL field

5. Close the Base URLs submenu

You can do so by clicking the up arrow. Then, open the Base URLs (Secure) submenu by clicking the down arrow.

6. Go to the Secure Base URL field

Update the value by changing your old domain name to the new domain name.

Go to the Secure Base URL field and update the value

7. Click Save Config

Click the save config button

8. Test the new domain name

You can test the new base URLs by both browsing an existing product as well as by creating a temporary new test product.

Note: Though Magento is supposed to automatically update the cache, if your site is now returning 404s when using your new base URLs, you may need to manually flush your Magento cache.

Don’t forget: Update your DNS records when changing your domain name to ensure that your new domain points to your Magento store. Note that updating DNS records can sometimes be quick, but sometimes it can take up to two days. If you’re a Nexcess customer, read our article on changing domains and DNS records to learn more, and use our DNS checker tool to ensure your new domain works properly.

Now you know how to change your domain name in Magento 2

That’s it!

Whether you’re building a site from scratch or have an existing site you’d like to migrate over, we’ve got you covered. Check out our fully managed Magento hosting plans to get started today.

Michael Pruitt
Michael Pruitt


Michael Pruitt is a Support Systems Administrator for Nexcess. He brings over a decade of experience to his current role. When not working, Michael can be found officiating roller derby bouts.

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.