0

I have a web in a server, but I want update magento. To update I want copy the original magento in localhost, but I am having problems by redirect.

I explain my process:

  1. I downloaded all content magento in my server.
  2. I upload to my server in localhost all content.
  3. I create in /etc/apache/sites-available a file to run my web.
  4. I comprobe that it ran (with an error but ran).
  5. I copy my sql script and run the script in my local database.
  6. When I load my web in localhost it redirect to original magento.

I think that exists something in database that redirect my localhost to original because if I don't import the database, It redirect me well. But I don´t know that is the problem.

1
  • Have you checked if you've got an .htaccess inside the base directory interfering? Commented Jan 14, 2021 at 11:17

3 Answers 3

0

You need to update our base URLs in the core_config_data database table.

This article explains how to do this: https://magento2.atlassian.net/wiki/display/m1wiki/Update+Site+URL+in+core_config_data+after+you+move+to+a+new+server+or+change+domains

1
  • I change this but it do the same
    – AndresF
    Commented Dec 29, 2016 at 8:12
0

Connect to your database server or run this in PhpMyAdmin:

UPDATE `core_config_data` SET `value` = 'http://localhost/' WHERE `core_config_data`.`path` = 'web/unsecure/base_url';
UPDATE `core_config_data` SET `value` = 'http://localhost/' WHERE `core_config_data`.`path` = 'web/secure/base_url';

And then clean your cache.

Magento uses the database configuration to get the site url. It redirect all other urls to that url. So your Magento configuration is still redirecting you to the url stored in the database. With the script above we set the url in the configuration to http://localhost/.

I would advice to not just use localhost (Magento/Cookies behave weird sometimes). Instead you could make a local domain like localhost.com to redirect to your local server. You can use the host file for this.

2
  • I change this but it do the same
    – AndresF
    Commented Dec 29, 2016 at 8:12
  • Have you cleared your var folder
    – Pawan
    Commented Dec 29, 2016 at 18:28
0

First of all in app/etc/env.php change server database detail to your localhost database detail like as follows

'connection' => [
            'default' => [
                'host' => 'localhost',
                'dbname' => 'mage2351',
                'username' => 'root',
                'password' => 'root',
                'active' => '1',
                'driver_options' => [

                ]
            ]
        ]

Chnage dbname,host,username , password of your mysql detail in above array

and than change urls in core_config_data

with following querries

UPDATE `core_config_data` SET `value` = 'http://localhost/yourlocalprojectfoldername' WHERE `core_config_data`.`path` = 'web/unsecure/base_url';
UPDATE `core_config_data` SET `value` = 'http://localhost/yourlocalprojectfoldername' WHERE `core_config_data`.`path` = 'web/secure/base_url';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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