Magento – Admin page gives 404 error after domain name change

404-pageadmindomainmagento-1.9

I have moved a magento store from one server to another and had the domain name changed as well. The front end works fine, the /admin/ just shows the magento 404 page. I have tried every solution I could find – none have worked.

  • updating/verifying app/etc/local.xml
  • scanning the databse dump for instances of old domain name [none]
  • dumping /var/cache/* /var/session/*
  • ran this little bit of SQL:

SET FOREIGN_KEY_CHECKS=0;
UPDATE core_store SET store_id = 0 WHERE code=’admin’;
UPDATE core_store_group SET group_id = 0 WHERE name=’Default’;
UPDATE core_website SET website_id = 0 WHERE code=’admin’;
UPDATE customer_group SET customer_group_id = 0 WHERE customer_group_code=’NOT LOGGED IN’;
SET FOREIGN_KEY_CHECKS=1;

  • checked .htaccess
  • server and magento logs, an error shows up in the magento log:

2016-02-26T19:46:43+00:00 ERR (3): Recoverable Error: Argument 1
passed to Mage_Core_Model_Store::setWebsite() must be an instance of
Mage_Core_Model_Website, null given, called in
/var/www/html/app/code/core/Mage/Core/Model/App.php on line 645 and
defined in /var/www/html/app/code/core/Mage/Core/Model/Store.php on
line 453

2016-02-26T19:46:43+00:00 ERR (3): Recoverable Error:
Argument 1 passed to Mage_Core_Model_Store_Group::setWebsite() must be
an instance of Mage_Core_Model_Website, null given, called in
/var/www/html/app/code/core/Mage/Core/Model/App.php on line 665 and
defined in
/var/www/html/app/code/core/Mage/Core/Model/Store/Group.php on line
275

Which leads to this:

public function setWebsite(Mage_Core_Model_Website $website)
    {
        $this->_website = $website;
    }

So something is calling the function but not passing in the $website variable.

How do I fix this??

Best Answer

You need to check your database in core_config_data table settings. Make sure that BOTH entries for your domain are set to the proper domain name.

The entries you must look for are: web/unsecure/base_url and web/secure/base_url

Change both to be your new domain name. Then clear the var/session and var/cache folders.

That should fix the problem. If not, restart apache. If that does not work, then make sure to clear whatever caching system you are using (redis, etc..)

Note: I'd highly recommend re-configuring to use something other than /admin for security reasons.

Related Topic