Best way to move Magento installation from sub to root?

Okay, I’ve found detailed information on how to move a Magento installation to a different server with mysql dumps and all that.

But what is according to you the best and easiest way to move a Magento installation from a subdirectory to root level?

For example if you’ve installed and developed your Magento store in public_html/dev_site and want to move it to public_html/ (root level)?

Any good advice on this?

Is it only to move all the folders and files up one level or do you need to change anything else?

Appreciate suggestions 🙂

Thanks!

D

6 answers

Profile photo of Daniel Löf 0.00 $tone November 27, 2011
Public

Hi Blaine!

Thanks for the information!

Please correct me if I am wrong but as I will be moving my Magento site from a sub folder to root level on the same server I will not have to do anything to my database.

Do I have to update any links in Magento backend to for example cache folders or something like that?

(I’m comparing this to how you would move a Joomla installation in the same way)

#2
Profile photo of tomc 0.00 $tone November 27, 2011
Public

If you’ve installed Magento in a subdirectory or even the root web directory and would like to move it somewhere else, here is how you do it.

Let’s say you have Magento installed in the following location:

http://www.yourdomain.com/store/

And you want Magento to be the first thing that comes up when visitors go to your site:

http://www.yourdomain.com

We’ll assume you have a directory structure like this:

/home/username/public_html/

Meaning Magento would be installed here:

/home/username/public_html/store/

First, login to the backend of Magento and go to: System -> Configuration -> Web

Update the Unsecure and Secure URL for your store.Also you can change the path directly with SQL (for example with phpMyAdmin or mysql command):

UPDATE core_config_data SET value = ‘http://www.yourdomain.com/’WHERE path = ‘web/unsecure/base_url’;

UPDATE core_config_data SET value = ‘https://www.yourdomain.com/’WHERE path = ‘web/secure/base_url’;

Next, connect to your site via SSH and go to the directory where you will be moving Magento:


Now, move all the files from the store directory to the directory you’re in:

mv store/* store/.htaccess .

Delete the cache data:

rm -rf var/cache/ var/session/

And you’re done. Magento has now been moved up one directory.If you visit your site and it doesn’t look like the theme is properly coming up, you might need to check the unsecure and secure values again.

#3
Profile photo of Daniel Löf 0.00 $tone November 27, 2011
Public

Thanks Tom!

I suppose it is the Base-URL that I will change, found these.

However, I have never connected to my site with SSH. Is there another way to do it just by FTP?

#4
Profile photo of tomc 0.00 $tone November 27, 2011
Public

Thanks Tom!

However, I have never connected to my site with SSH. Is there another way to do it just by FTP?

You can do it via FTP as well -- same process.

Make sure you make a BACK UP of your site FIRST -- better safe than sorry.

#5

This question is now closed

Written By

Comments