I'm using Magento 2

We have moved the site from one domain to another and also changed the folder location one IP address to another IP address.

After the change the admin panel is working fine but in then front-end, except for the home page, every page/link is redirecting to the old domain.

Categories and product links are also redirecting to the old domain

I have tried the following :


update core_config_data set value = 'http://newdomain.com/' where path = 'web/unsecure/base_url'; 
update core_config_data set value = 'http://newdomain.com/' where path = 'web/secure/base_url';

2) Delete sudo rm -rf var/cache/*, var/page_cache var/view_preprocessed pub/static/ folder After deleting I have run following commands

php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cache:flush
php bin/magento cache:clean


    UPDATE `store` SET store_id = 0 WHERE code='admin';
    UPDATE `store_group` SET group_id = 0 WHERE name='Default';
    UPDATE `store_website` SET website_id = 0 WHERE code='admin';
    UPDATE `customer_group` SET customer_group_id = 0 WHERE        customer_group_code='NOT LOGGED IN';
  • Check the env.php , maybe you have the same name of database . Commented Oct 18, 2018 at 17:58
  • Please check your .htaccess file from Magento Root Directory, if there is any code for redirection Please remove and check after flush cache. Commented Oct 19, 2018 at 5:32
  • Try to restart apache. For some share hosting like godaddy try to switch php version and clear browser cache. Commented Sep 4, 2019 at 7:41

1 Answer 1


In core_config_data you need to change the values for web/unsecure/base_link_url and web/secure/base_link_url path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.