Magento - Moving Directory from Test to Live

Many Magento users try the application out first on sub-directory or test directory. A lot of times, moving an application from test directory to live directory can be hectic and time-consuming. Luckily, it is relatively easy to move Magento from one directory to another withing the same server.

  • Backup everything.
  • Update the unsecure / secure URLs via the Admin panel.
    System -> Configuration -> Click Web from the left menu.
    i.e.) Change http://www.mycompany.com/test/ to http://www.mycompany.com.
    When you save the new URLs through the Admin panel, it will show error messages after you’re done. This happens because the Admin can’t be redirected to the old directory any more. Just ignore the message.
    If you’re familiar with SQL queries, you can update the URLs directly from database using phpMyAdmin or other database tool:
    update core_config_data set value='NEW URL' where path like '%base_url%';
  • Delete the cache from /var/cache/.
  • Move all the files to the new directory.
    You can use a file manager tool that your hosting company provides, do SSH or use FTP. The file manager tool from cPanel is fast and reliable.

This procedure should work in both ways:
when you move Magento from sub-directory to top as ‘http://www.mycompany.com/test/’ to ‘http://www.mycompany.com/’
or from top to sub-directory as ‘http://www.mycompany.com/’ to ‘http://www.mycompany.com/shop/’.

You don’t have to use the word ‘magento’ when you move your store to sub-directory.

2 Comments

  • By jimbo, October 10, 2009 @ 9:03 am

    Great stuff……….easy to understand for the layman like me. your a legend

  • By Lazzo, January 3, 2010 @ 12:16 pm

    After changeing URL I had some trouble with wrong path in /downloader/pearlib/pear.ini, this caused Magento Connect to install extension in the “old” directory.

    I did the following to solve this problem:
    1) Take a backup of the file /downloader/pearlib/pear.ini
    2) Delete (or rename) pear.ini
    3) Go to Magento connect manager – the settings are resteted back to “stable”, change it to beta and press save. A new pear.ini file should now be created with the correct path.
    4) Done

    Good luck!

Leave a comment