Magento Root DIR – Moving SUB DIR in to ROOT DIR

The Root Directory is the top level folder for a specific Mage online store. For Example in an Apache server the “public_html” folder is the most used name for the Magento Root Directory. Here we will discuss, “How to move Magento from Subdirectory to Root Directory”.

As you might lose your content while doing the transfer Magento Root Directory. Further we suggest to keep a database backup and appoint an expert. Here it seems that a good hosting provider with necessary support is mandatory for your Mage store. Our all of three (03) hosting plans features 24×7 technical support. Hence our technical experts will do such above mentioned task for our clients. So, enjoy dedicated Mage Hosting Plans start from $9.99 per Month.

Tanzia Farin Chy – Aspiration Hosting  

Case Study

However this is a common issue for merchants regarding the test Subfolder. Generally merchants create the Subfolder inside the Magento Root Directory for testing purpose. Next they install the online store under the Subfolder.

For example: http://www.yoursite.com is the main store the merchant would like to display. Instead of the main source our client installed Mage under some target folder such as http://www.yoursite.com/cart.

Now the merchant wants to display the contents under main source. So in that case we need to move Magento from the SUB DIR to ROOT DIR.

The Magento Root Directory – moving Target folder into Source folder

First log in to Admin panel (Backend) using the credentials. Next navigate through System > Config > Web. Here under the Config search for “base URL” setting. Now, update the following settings and click Save Config.

Note: In the base URL instead of http://yoursite.com/cart use your own URL.

Setting Store View (base_URL as the root_URL)

On the left side bar, find “Current Config Scope” for store view. Now from the drop down list chose “your store” instead of “Default Config” as store view.

magento root directory

Now on the same window, check and update “Session File Management Cookie Path”. Hence, set your site Root Folder instead of any existing folder.

magento root directory 01

Copying Mage files – in to store’s Magento Root Directory

Finally we need to copy Mage files in to the Magento Root Directory. As the files & contents should be under the ROOT folder to move Magento properly from ROOT to SUB. The following is the list of files needed to be moved from SUB DIR to ROOT DIR:

  1. index.php
  2. .htaccess file
  3. symlink your media
  4. skin and js folders etc.

But as the files and folders are currently available only in the SUB folder. So, we need to inform our domain the location of the Mage folders. Now, using secure shell in the Mage Root DIR www.yourstore.com/targetshop as sudo.

sudo cp index.php ../

sudo cp .htaccess ../ sudo ln -s js ../ sudo ln -s skin ../ sudo ln -s media ../

Next we need to change our admin from yourstore.com/tragetstore/admin by using the index.php file. On the in line 45 change the following:

$targetstoreFilename = 'app/targetstore.php';

Revised Version

$targetstoreFilename = 'cart/app/targetstore.php';

Finally save and clear cache to effect the changes have been made. Best of luck!