Disclosure: This post may contain affiliate links. This means, at no additional cost to you, I will earn a commission if you click through and make a purchase.
Magento Open-Source E-Commerce Community Edition: 2.30
The other day I noticed my e-commerce website was redirecting to the old site. It happened after I moved my Magento e-Commerce website from one server to another.
To fix the issue I had to update my credentials and update several files.
Update Magento Credentials
One of the first things you’ll need to do is change your Magento credentials located in /app/etc/env.php. I like to use cPanel File Manager when making this change.
Remember to always backup your env.php file before updating it. To do so you can add .bk after the env.php file name, like env.php.bk. Then copy the backup file to make another version of the env.php.
Edit the env.php file and make sure the database, username, and password are correct.
‘dbname’ => ‘(enter magento database name here)’,
‘username’ => ‘(enter magento username here)’,
‘password’ => ‘(enter magento password here)’,
Update Config Data Table
The next thing you’ll want to do is go to phpMyAdmin on your cPanel. Select your database and find the table named core_config_data. In this table you’ll want to update your URLs to point to the correct website.
These values should show up on the first page of the core_config_table. Look for the path web/unsecure/base_url and web/secure/base_url. If you do not see these values, sort the config_id column in ascending order so that you see config_id 1 as the first row. These two paths are shown on the rows config_id 2 and 3. Now just update the values for those rows to the correct URLs.
You should now be able to access your website without it redirecting to the old URL. And remember if all else fails try deleting the contents out of the folder var/cache using the File Manager in cPanel or by SSH command.