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');
var_dump($storeManager->getStore()->getBaseUrl());exit;
It returns the old website