Holt DevOps News

Base Url Change Magento 2

News Categories: MagentoWe Website Design News

This article was published on: 04/16/21 7:47 PM

Base Url Change Magento 2

We come across this from time to time and it’s a common issue when a client changes their domain name due to a rebrand or upgrade from .co.uk to .com

When we changed a Base Url Change Magento 2 there are several sets to take but as always please take this as a guide and backup, backup and backup before modifying your Database.

So, let’s dive straight and take an example that our client is changing from a .co.uk to a .com. example www.domain.co.uk to www.domain.com


Lets Go.

Log in to your server via SSH (we are using a terminal on a mac)

Connect to your Database – this can be controlled like this:

mysql -u root -p 

Enter password when asked.

Then we need to update baseurl in core_config_data:

UPDATE core_config_data
> SET value = 'http://www.yourdomain2.com/'
> WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url')

Next Step

UPDATE core_config_data
> SET value = REPLACE(value, 'http://www.domain.co.uk/', 'http://www.domain.com/')
>WHERE path = 'design/head/includes';

If this throws up an error use following: This happened to us on the MariaDB cloud server

Change the web/unsecure/base_link_url also:

UPDATE core_config_data
> SET value = 'http://www.yourdomain2.com/'
> WHERE path IN ('web/unsecure/base_link_url');


Then changed Store Url

php bin/magento setup:store-config:set --base-url="http://www.domain.com/"

php bin/magento setup:store-config:set --base-url-secure="https://www.domain.com/"

Finally to finish clearthe cache:

php bin/magento cache:flush


Let's build a better web together

Get in touch with us for a quick quote

Web Development Agency, We Website Design

We’re eCommerce Experts in Cutting-edge Design & Development Technologies - Worldwide accreditation from leading digital platform providers including Shopify, WordPress & Magento.

Web Development Agency Manchester

Woolden Road
M44 5JX

Web Development Agency London

71-75 Shelton Street
Covent Garden

Let's hook up


0161 676 8989

Stalk Us On Social

What We Do

  • Shopify
  • WordPress
  • Magento
  • SEO
  • Aero Commerce
  • Shopify 2.0

Copyright 2022 We Agency - White Label Web Development Digital Agency.
Registered in England & Wales We Agency is a trading division of We Website Design Ltd. Company Registration Number 14175442 Privacy Policy

Ready to work with us?

Drop us your details and we will arrange a social distanced meet & greet or video chat so you can see our beautiful faces.