Copy Magento 2 Production Server to Localhost – Step-by-Step Guide

admin-panellocalhostmagento2

I copied my whole Magento 2.1 root directory to my local computer. Also exported and copied the database.sql to my local computer.

Then I setup XAMPP and created a db (with same name as db in production) -> imported the database.sql. After that I changed the base-url from Magento 2.1 to http://127.0.0.1:80/Servercopy/ -> then changed admin uri admin_grw0o8 to adminPath.

When opening url "http://127.0.0.1/Servercopy/" in Chrome it shows me correctly my Magento 2.1 webshop.

Problem: When openeing url "http://127.0.0.1/Servercopy/adminPath" it shows error ERR_TOO_MANY_REDIRECTS

How can I solve this ?

Maybe when I change xampp hostname '127.0.0.1' to 'mydomain.com' ?

Best Answer

You have to manually change a couple of values in core_config_data MySQL table too:

UPDATE core_config_data 
SET value = 'http://127.0.0.1/' 
WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url');

NOTE: The trailing slash after 127.0.0.1 is important!

When done, flush your cache manually. You can do it by deleting var/carche folder or by running php bin/magento cache:flush from your commandline.

This should work. Now your local copy will open at http://127.0.0.1/

Related Topic