Magento store website URL in table core_config_data. This is the same for Magento 1 and Magento 2. To see the current URL, in phpMyAdmin or MySQL command line, run
select * from core_config_data where path like '%_url';
Normally this shows 2 entries. If it shows more than 2 entries, it is because you have more store configured in your Magento installation. In such a case, you should be careful to change the correct URL.
To change the URL, run
UPDATE core_config_data SET value = 'https://NEW_URL_HERE/' WHERE path = 'web/unsecure/base_url';
UPDATE core_config_data SET value = 'https://NEW_URL_HERE/' WHERE path = 'web/secure/base_url';
Replace https://NEW_URL_HERE/ with your new website URL.
Magento 2
If you move a site from one site to another with a different folder structure, some static resources may not work as they use symlink and the path does not exist. To fix this, you need to redeploy the static assets.
Clear the pub/static directory (excluding the .htaccess file):
rm -rf var/www/html/pub/static/*
Clear generated directory:
rm -rf var/www/html/generated/*
Generate static files.
php -d memory_limit=-1 bin/magento setup:static-content:deploy -f
If you have multiple languages, you can use
php -d memory_limit=-1 bin/magento setup:static-content:deploy -f en_US en_GB
Clear cache with the command
php bin/magento cache:flush
Magento 1
If you use Magento 1, use the following command to flush the cache.
php -r 'require "app/Mage.php"; Mage::app()->getCacheInstance()->flush();'
See Magento