Magento 2:在magento 2管理员登录页面上未找到错误404


12

我已经将magento 2安装到我的个人计算机中。在那边工作正常。

我已经在另一个系统上安装了相同的副本,那么前端工作正常,管理员却没有。(显示404页)

现在,我想将其安装到笔记本电脑中。

我照做了...

  1. 我只是从我的PC复制magento2文件夹,即将wamp/www/magento2其放置在笔记本电脑的适当位置,即wamp/www/magento2

  2. 我从PC导出magento2数据库,并在Laptop localhost导入。

  3. 更新base_url到导入的数据库。

  4. 删除的内容var/如下pub/static/

我尝试跟随...

  1. 运行php magento setup:upgrade但没有用。

Answers:


9

这是一个一般性错误,通常是在将magento-2安装从一个位置转移到另一个位置时发生的。这个错误背后的原因是该值store_idwebsite_id为admin应该是0,但是当你导入数据库到新的服务器,不知何故这些值未设置为0
因此,要解决此错误,您将需要对数据库表本身进行一些更改。

SET FOREIGN_KEY_CHECKS=0; UPDATE store SET store_id = 0 WHERE code='admin'; UPDATE store_group SET group_id = 0 WHERE name='Default'; UPDATE store_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;


0

在.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>

0

不执行任何操作,只需检查根目录下的.htacess文件即可。如果已经存在,请重命名并使用默认值;如果不存在,则使用默认值。清除缓存/刷新缓存,然后开始

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.