Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change base URL of Magento

I have installed Magento in a server say 123.456.10.129 and copy and paste its files to 123.456.241.82. When I am trying to access Magento from 123.456.241.82its getting redirected to 123.456.10.129. How to change the base URL for Magento? Can I keep the same database for both Magento?

like image 672
RoSe Avatar asked Jan 31 '14 04:01

RoSe


People also ask

What is the URL for Magento Admin?

The Magento 2 admin URL allows you to access the backend of the store and then edit and manage the administrative tasks. Typically, the default Magento 2 admin URL is “yourdomain.com/magento/admin.”


2 Answers

If you would like to run two identical websites from one database on two separate URL's i.e Staging/Production then you can simply override the default base_url in the database by setting the values in local.xml found under app/etc in your secondary server installation.

Under the admin node add the following -

<stores>
    <default>
        <web>
            <unsecure>
                <base_url>http://YOUR.URL.HERE/</base_url>
            </unsecure>
        </web>
    </default>
    <admin>
        <web>
            <unsecure>
                <base_url>http://YOUR.URL.HERE/</base_url>
            </unsecure>
        </web>
    </admin>
</stores>

Hope this helps with your issue.

like image 133
Steven Avatar answered Sep 25 '22 22:09

Steven


Do an update in the table core_config_data where the path column is equal to http://123.456.10.129/ (Do not forget the trailing forward slash). Change that to what ever your new IP address is like http://123.456.241.82/ (Again, do not forget the trailing forward slash.

A sample query would be like this.

USE database;

UPDATE core_config_data SET value='http://123.456.241.82/' where value='http://123.456.10.129/';

@Mahan 's answer is correct. But you also need to remove the folders in the var\cache folder and files in the var\session folder. Then just refresh the page.

like image 33
Justin Paul Paño Avatar answered Sep 21 '22 22:09

Justin Paul Paño