How to Move Magento from Subdirectory to Root Directory
Powerful website, blog as well as online store starts from registering a domain name. It has a huge impact in the way human and search engines perceive a site and can greatly influence shop recognition. The best domain names are those that people can remember since they will protect your identity. Thats why it is really important to keep your domain name after shopping cart migration. In this article we are going to explain how to resolve common issues concerning domain names modifications in Magento shopping cart.


It is a common situation while migrating to Magento when e-merchant creates a test subfolder in a root folder. After that, installs a target shopping cart right there. As a result, store owner has a source store in root - www.mystore.com and target store in some subfolder - www.mystore.com/targetstore/. Accordingly, after migration is completed, target store will be located in a subfolder. Consequently, merchants face a dilemma. They want customers to type the www.mystore.com and see the live target store instead of typing www.mystore.com/targetstore.

So, how to solve this dilemma?

First of all you should enter your admin panel and go to System -> Config -> Web. There you will see settings for your “base URL”, which you will have to update.

Step 1. Set the default store to the proper “base URL”

How to Move Magento from Subdirectory to Root Directory

Please take into a consideration that the “base URL” has the subfolder defined.

Step 2: Set your store view “base URL” to the “root URL”

On the left you will see a drop down list where you will have to change the "Current configuration scope" to your store view (choose not default one).

How to Move Magento from Subdirectory to Root Directory

After that you have to change the “base URL” value. To do that simply uncheck 'use website' and enter your new “base URL”:

How to Move Magento from Subdirectory to Root Directory

Also, double-check in the same screen that your Session file management cookie path is set to the root folder of your site and that the domain is correct:

How to Move Magento from Subdirectory to Root Directory

Step 3. Copy files to your root directory

Last but not least. You will have to copy the index.php file, .htaccess file, and symlink your media, skin and js folders to your root directory, since they are only available to your subfolder Magento base install right now - you will need to let your main domain know where to look for Magento! From secure shell in your Magento installation directory www.mystore.com/targetstore as sudoer:

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

Note, your admin will still be available at mystore.com/targetstore/admin

Edit your index.php file in this main webroot (the file you just copied) and update it around line 45:

$targetstoreFilename = 'app/Targetstore.php';
Change this to:
$targetstoreFilename = 'cart/app/Targetstore.php';

Where 'targetstore' is the subfolder. Finally, you need to clear the cache for these changes to take effect.

Please take into consideration, such procedure will be suitable only in case you use the same server.

Need to move store database from one Magento to Magento migration store to a completely another one? Try out automated Magento migration using Cart2Cart, and get your data transferred in terms of several hours!

Monthly Update – November 2025

November 2025 brings with it heightened activity across the e-commerce landscape, making optimal store performance and a robust technical setup more crucial than ever. For Magento users, having your store correctly configured in the root directory, as detailed in this guide, is fundamental for maximizing both user experience and search engine visibility. A clean, direct URL structure is preferred by search algorithms and aids in efficient site crawling and indexing, which are vital for attracting organic traffic. Moreover, with the peak holiday shopping season rapidly approaching, ensuring your Magento store operates seamlessly without any domain-related hiccups can directly impact sales and customer satisfaction. Issues stemming from incorrect subdirectory configurations can lead to broken links, slower load times, and a fragmented SEO presence, all of which deter potential customers. Regularly verifying your base URL settings, .htaccess redirects, and index.php paths are proactive steps that safeguard your store’s integrity. Embracing best practices for domain management not only enhances discoverability but also builds trust with your audience, contributing significantly to your overall e-commerce success this season and beyond.

For more details, explore our FAQ section or schedule a call with a migration expert.