I have installed magento 2 into my Personal Computer. It working fine over there.

I have installed same copy at another system then frontend is working fine admin is not. (its showing 404 page)

Right now I want to install it into my laptop.

I did following...

  1. I just copy magento2 folder from my PC i.e wamp/www/magento2 and put it at proper destination into laptop i.e wamp/www/magento2

  2. I export magento2 database from PC and import at Laptop localhost.

  3. Update the base_urlinto imported DB.

  4. Deleted contents unders var/ as wel as pub/static/

I tried following...

  1. run php magento setup:upgrade but not useful.
up vote 8 down vote accepted

This is a general error, usually occurs when you transfer your magento-2 installation from one location to another. The reason behind this error is that the value store_id and website_id for the admin should be 0 , but when you import the database to a new server, somehow these values are not set to 0.
So to solve this error you will need to make some changes in the database tables itself.

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;

add these line 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>

Don't do anything, just check the .htacess file at the root directory. If it's already there, rename it and use the default on and if it's not there then use the default one. Clear your cache / flush your cache and here you go

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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