We have a dedicated server managed with whm and cpanel for the domains.

I have created a dev version for my magento 2 website https://domain.com.

I have uploaded files and database, changed in core_config_data table for web/unsecure/base_url and web/secure/base_url to have the new domain dev.domain.com.

Now the issue is the new domain has links who redirects to the old domain, in the top navigation, menu, account creation link, ...

The original website is multistore website with 3 stores with mode developper activated

When viewing the new domain firstime i got session error, i fixed it adding 'save_path' => '/tmp'

'session' => [
 'save' => 'files',
 'save_path' => '/tmp', 

In app/etc/env.php

In the original website, there’s no problem related to session, is adding this config causes a problem? I cleared cache folder var/cache

rm -rf var/cache/*
rm -rf /var/tmp/magento/*

, also with this command

php bin/magento cache:flush

also removed static files

rm -rf pub/static/adminhtml pub/static/frontend

Reindex links

bin/magento indexer:reindex

But always menu and top navigation links are from the old domain I tried this question all links redirecting to old domain after moving to new domain and this Moved magento to new domain, admin URL redirect to old admin URL but without a solution.

Edit in I added this code to get base url in module-theme Topmenu.php file

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');

It returns the old website

  • As you have mentioned the website is multistore, there will be multiple values as per scope_id in core_config_data for path web/unsecure/base_url. Just make sure you change all store values instead of changing for only default scope.
    – Yash Shah
    Apr 5, 2019 at 4:43
  • @YashShah it is fixed when i changed the web/secure/base_link_url to the new domain Apr 5, 2019 at 10:52

2 Answers 2


Try these commands

 1. rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
 2. php bin/magento setup:static-content:deploy -f

I solved the problem by changing the old domain for different stores in app/etc/env.php

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.