Zend certified PHP/Magento developer

Changing the domain on our main Magento 2.4.2-p1 store crashes the Magento Admin panel

Magento 2.4.2-p1
Smartwave Porto theme

We have a problem with our new Magento 2.4.2-p1 which is running on a NEWmagento account in our VPS hosting account. This appears when I try to set the Main store on a different domain. I found an article from our hosting company regarding the process:

https://www.fastcomet.com/tutorials/magento2/change-domain

Here is what I’m trying to do:

On our old Magento 1.9.4 running on the OLDmagento account in the same VPS hosting account, we have the following in Configuration:

Default Config:

Main website and ‘Main website default store view‘:

We access that Magento’s Admin panel via https://www.justadomainwhereOLDmagentoISinstalled.com/admin and this works perfectly well (no problems).

I was trying to move the actualproductionstoredomain.com domain yesterday from the old Magento 1.9.4 (on OLDmagento account) to the new Magento 2.4.2-p1 (on NEWmagento account) and without even reading the article from our hosting company – I have done exactly what those steps in the article are = change the Secure and Unsecure URL for the Main store (NOT the default Config) and it completely crashed the Admin panel = the Admin panel was showing as a broken version of the website right away or as an internal Magento 404 later when trying to access it directly via the Admin URL = https://www.justadomainwhereNEWmagentoISinstalled.com/admin

I had to do the following yesterday just to bring the Magento Admin panel back:


Step 1:

Connect to our database via phpMyAdmin, sort the rows by the Value heading and look for starting with http…

Step 2: Change the incorrect URL(s) to the right one(s) on all the lines = back to https://www.justadomainwhereNEWmagentoISinstalled.com

Step 3: Run the following commands via SSH:

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy -f

php bin/magento cache:clean

php bin/magento cache:flush

php bin/magento indexer:reindex

Luckily, this did fix the Admin panel and I’ve put the actualproductionstoredomain.com domain back to THE OLDmagento account for the time being.


I have done a new experiment today:

  1. I set up a new domain in Domains in the cPanel of the NEWmagento account = TESTdomain.com.

  2. I’ve changed the Base URL in the ‘Default Store View’ only under ‘MAIN WEBSITE’ (NOT the ‘Default Config’ mind you) to the following for both Secure Base URL and Unsecure Base URL:

http://www.TESTdomain.com/

As soon as I have saved this change, the Admin panel broke and is only showing a broken version of the website itself.

Also, if I try to access the Magento Admin panel directly by going to:

https://www.justadomainwhereNEWmagentoISinstalled.com/admin

It shows the same = broken version of the Main Store’s website.

Why is this happening and how to fix it? The way we had this set up previously on our old Magento 1.9.4 and the articles I found seem to suggest this should not happen.

One thing I did notice is that we have the actual domain in Base Link URL instead of {{unsecure_base_url}} or whatever value that suppose to have. Could that be causing the problem?