https://mage2.pro/t/topic/22
Magento 2.0 similar to Magento 1.x stores shop root URL in the core_config_data
database table.
The record paths are same: web/unsecure/base_url
и web/secure/base_url
.
So you can change root URL by SQL query:
UPDATE core_config_data
SET value = 'http://example.ru/'
WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url');
It is sufficient for Magento 1.x but not for Magento 2.0.
Magento 2.0 for some strange purpose additionally stores root URL in the third path: design/head/includes
The record looks like:
<link rel="stylesheet" type="text/css" media="all" href="<root URL>/pub/media/styles.css" />
So you need one more SQL query:
UPDATE core_config_data
SET value = REPLACE(value, '<old root URL or domain>', '<new root URL or domain>')
WHERE path = 'design/head/includes';
For example:
UPDATE core_config_data
SET value = REPLACE(value, 'http://old.com/', 'http://new.com/')
WHERE path = 'design/head/includes';
Then delete the cache:
rm -rf var/cache/*