Crucial Hosting

Moving a Magento shop to a different directory

This article explains how you relocate your Magento shop to a different directory.

  • Applies To: All Services
  • Difficulty: Easy
  • Software Required: Magento & SSH
AWS
This article was last updated on November 4th, 2015

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.

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

cd public_html/

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/

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. Please see this article to learn how to update these values.

Professional hosting platform starting at $10/mo

View Plans