Question

I have a live Magento in development. I am connecting to that site by typing the IP address of the site.

Now, I just want to make sure if I edit core_config table and switch the base_url and secure base_url from the IP adress to a domain name (123.123.123.123 > example.com) and redirect domain name servers to my name servers site, this will work right?

I'm asking this because i'm confused. Last time I moved Magento from local to live the backend pages were broken. Will it work? Or are there any things that I must prepare?

Was it helpful?

Solution

If you specify your store code setup in app/etc/local.xml and remove the store URLs from the core_config table of the database then you can easily run the same DB on localhost and remote.

Add a 'default' section to app/etc/local.xml, this section being inside 'config'

<default>
    <web>
        <unsecure>
            <base_url><![CDATA[http://local.localtest.me/]]></base_url>
            <base_web_url>{{unsecure_base_url}}</base_web_url>
            <base_link_url>{{unsecure_base_url}}</base_link_url>
            <base_js_url>{{unsecure_base_url}}js/</base_js_url>
            <base_skin_url>{{unsecure_base_url}}skin/</base_skin_url>
            <base_media_url>{{unsecure_base_url}}media/</base_media_url>
        </unsecure>
        <secure>
            <base_url><![CDATA[https://local.localtest.me/]]></base_url>
            <base_web_url>{{secure_base_url}}</base_web_url>
            <base_link_url>{{secure_base_url}}</base_link_url>
            <base_js_url>{{secure_base_url}}js/</base_js_url>
            <base_skin_url>{{secure_base_url}}skin/</base_skin_url>
            <base_media_url>{{secure_base_url}}media/</base_media_url>
        </secure>
    </web>
</default>

Use that just on your localhost and take the local.xml file out of version control. On the live server replace the URLs given above to the live ones.

Now in your db you will need to remove the keys in core_config_data for base_url etc.

At runtime the settings will be merged into one huge configuration object that gets cached.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top