Search code examples
phpmagentomagento-1.8

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?


Solution

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