php Magento 管理员登录页面中的“错误 404 未找到”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5178066/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 20:33:36  来源:igfitidea点击:

"Error 404 Not Found" in Magento Admin Login Page

phpmagento

提问by Mukesh Chapagain

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:-

我刚刚将我的 magento 安装从一台本地机器服务器转移到另一台机器服务器。现在,我无法登录管理面板。当我转到管理员登录 url 时,收到以下错误消息:-

"Error: 404 Not Found"

“未找到错误404”

Some of my module's pages also show this error.

我的一些模块页面也显示此错误。

Can anyone please figure out the problem?

任何人都可以找出问题吗?

回答by Mukesh Chapagain

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.

我查看了 Magento 系统日志文件(var/log/system.log)。在那里我看到了确切的错误。

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

可恢复错误:传递给 Mage_Core_Model_Store::setWebsite() 的参数 1 必须是 Mage_Core_Model_Website 的实例,给定 null,在第 555 行的 YOUR_PATH\app\code\core\Mage\Core\Model\App.php 中调用并在 YOUR_PATH\ 中定义app\code\core\Mage\Core\Model\Store.php 在线 285

可恢复的错误:传递给 Mage_Core_Model_Store_Group::setWebsite() 的参数 1 必须是 Mage_Core_Model_Website 的实例,给定 null,在第 575 行的 YOUR_PATH\app\code\core\Mage\Core\Model\App.php 中调用并在 YOUR_PATH\ 中定义app\code\core\Mage\Core\Model\Store\Group.php 在线 227

Actually, I had this error before. But, error display message like Error: 404 Not Foundwas new to me.

实际上,我以前也遇到过这个错误。但是,错误显示消息Error: 404 Not Found对我来说是新的。

The reason for this error is that store_idand website_idfor admin should be set to 0 (zero). But, when you import database to new server, somehow these values are not set to 0.

这样做的原因错误是,store_idwebsite_id为管理员应设置为0(零)。但是,当您将数据库导入新服务器时,不知何故这些值未设置为 0。

Open PhpMyAdmin and run the following query in your database:-

打开 PhpMyAdmin 并在您的数据库中运行以下查询:-

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

Magento:管理员登录页面中“错误:404 未找到”的解决方案

回答by Theo Kouzelis

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.

我刚刚复制了一个 Magento 站点并将其移动到了本地区域,因此我可以离线处理它并且遇到了同样的问题。

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

但最后我发现 Magento 正在强制从 http 重定向到 https 而我没有设置 SSL。所以这解决了我的问题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

它几乎说在 core_config_data 中将 web/secure/use_in_adminhtml 值从 1 设置为 0 以允许对管理区域的非安全访问

回答by jazkat

Thanks to all, for me this solution worked: Magento 404 page in backoffice after login

感谢所有人,对我来说这个解决方案有效: 登录后后台的 Magento 404 页面