"Error 404 Not Found" in Magento Admin Login Page
PhpMagentoPhp Problem Overview
I just transfered my magento installation from one local machine server to another. Now, I cannot login to admin panel. When I go to the admin login url, I get the following error message:-
"Error: 404 Not Found"
Some of my module's pages also show this error.
Can anyone please figure out the problem?
Php Solutions
Solution 1 - Php
Finally, I found the solution to my problem.
I looked into the Magento system log file (var/log/system.log). There I saw the exact error.
The error is as below:-
> Recoverable Error: Argument 1 passed > to Mage_Core_Model_Store::setWebsite() > must be an instance of > Mage_Core_Model_Website, null given, > called in > YOUR_PATH\app\code\core\Mage\Core\Model\App.php > on line 555 and defined in > YOUR_PATH\app\code\core\Mage\Core\Model\Store.php > on line 285 > > 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 > YOUR_PATH\app\code\core\Mage\Core\Model\App.php > on line 575 and defined in > YOUR_PATH\app\code\core\Mage\Core\Model\Store\Group.php > on line 227
Actually, I had this error before. But, error display message like Error: 404 Not Found
was new to me.
The reason for this error is that store_id
and website_id
for admin should be set to 0 (zero). But, when you import database to new server, somehow these values are not set to 0.
Open PhpMyAdmin and run the following query in your database:-
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;
I have written about this problem and solution over here:-
Magento: Solution to "Error: 404 Not Found" in Admin Login Page
Solution 2 - Php
I have just copied and moved a Magento site to a local area so I could work on it offline and had the same problem.
But in the end I found out Magento was forcing a redirect from http to https and I didn't have a SSL setup. So this solved my problem http://www.magentocommerce.com/wiki/recover/ssl_access_with_phpmyadmin
It pretty much says set web/secure/use_in_adminhtml value from 1 to 0 in the core_config_data to allow non-secure access to the admin area
Solution 3 - Php
Thanks to all, for me this solution worked: Magento 404 page in backoffice after login