9

I have moved my website on a new server (domain name is the same). Frontend is working properly but the admin login page gives a 404 Not Found error.

Most posts about this issue suggest the solutions mentioned on this post Transferring Magento website, admin panel URL gives 404

I've tried all of them but nothing worked. Is there something else I could do to fix this?

16

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;

Back up database before making any changes also see log file to find exact issue. Also you can refer link 404 magento admin error Hope this is helpful to you

  • 1
    Hi, I have already done that, but didn't work. – zekia Oct 29 '14 at 10:28
  • Sorry for that ... – Bhargav Mehta Oct 29 '14 at 10:32
  • The link suggests the same solution that you mentioned and I also cleared cache. Still not fixed though – zekia Oct 29 '14 at 10:40
4

I've run into a couple of things myself that could cause this

  • make sure the .htaccess is in place in the root directory
  • make sure mod_rewrite is enabled on the new server
  • check the Base urls in the core_config_data table
  • make sure caching is off or refreshed
  • check file owner and permissions of the files
2

You need to go your server directly and do this via SSH/ FTP

You have to delete the following file

 app/etc/use_cache.ser

If you get an error after that like

 Notice: Undefined index: 0 in /srv/www/vhosts/javra.com/htdocs/munchad2/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92

Then go to your Database Management.

Open PhpMyAdmin Go to your database Click SQL Run the following SQL Query: _

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;

Some thing strange happens with the cache when you move the databases from one server to another so it seems like you need to clear it out.

2

TRY THIS..re import ur db 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' */

if no success check this link also after tried the above mentioned one Magento 404 on Admin Page

2

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;

then remove two folders from file manager->var -> cache & session

  • 1
    As opposed to other suggestions, this was the correct process I needed to run. The query works to gain access but I still had to clear the other 2 folders. – aknatn Mar 16 '16 at 23:33
1

just add these in .htaccess

<IfModule mod_rewrite.c>

############################################
## Enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## You can put here your magento root folder
## path relative to web root

    #RewriteBase /magento/

############################################
## Workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## Never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## Rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>
1

We've moved servers a few times and each time we had the same or similar issues. We've made a catch all script we run on each new server and it's worked to fix all our issues for the last two migrations, you can give it a shot! The problem has usually been around the old url being stuck or cached somewhere or a permission is out of whack..

rm -rf var/cache
rm -rf var/full_page_cache/
rm -rf media/catalog/product/cache
rm -rf var/session/*
php shell/indexer.php --reindexall
chown -R apache .
systemctl restart mysqld
systemctl restart httpd 

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
find feeds -type f -exec chmod 644 {} \;
chmod 777 var -R
chmod 777 media -R
chcon -R -t httpd_sys_rw_content_t .
chcon -Rv --type=httpd_sys_content_t ..
0

You can also try to add index.php to the url like this:

https://website.test/index.php/admin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.