Magento 404 errors after server migration
In development it becomes a necessity on numerous occasions to move from one server to another; from localhost to live, staging to live, you get the drift. Moving a Magento installation can be very troublesome. More often than not the error that rears it’s ugly head is the dreaded 404 pages that appear either on the frontend, the backend, every page except the homepage, or various other arrangements.
There are a number of different reasons why this occurs, but hopefully once you reach the bottom of this list your problem will be solved. It will be worth making sure you are logging errors correctly. If you are unsure how to do this, check out “How to turn on error logging in Magento”.
Remove the use_cache.ser file
The file can be found inside the “app/etc” folder.
Clear your cache
If you have no access to the backend of the system, this will have to be done manually. Delete all of the files within the “var/cache” and “var/session” folders.
Modify key rows in database
Sometimes the errors after moving servers occur due to the way the database has been transferred. If certain values are not correct then your Magento store will not function correctly.
Open up phpMyAdmin (or whichever SQL management tool you are using on your server) and execute the following SQL on the database that Magento is using. As with any direct database modifications, please be careful and always take a backup.
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';
To stop the database error in future, whenever you backup your database add the line below to the top of the .sql file. This will prevent SQL from automatically assigning the id of 1 when we need it to be 0.
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */