How to migrate my Opencart store to a subdirectory? Step by Step guide

We know that for various reasons you may need to migrate your Opencart store to a subdirectory. Today we want to help you, the migration process may seem complicated, but with a step-by-step guide like the one we provide you below, it will be simple.

Moreover, have you thought that if your store has a lot of indexed content and you carry out the migration inadequately, you can lose all the current traffic and consequently have a sharp fall in sales on your ecommerce platform? That’s why it’s important to read this post and own this knowledge.

process of migration of an ecommerce tu a subdirectory

Why should I consider migrating to a subdirectory?

Sometimes, it’s necessary to move your website to a subdirectory for various reasons, such as site restructuring, separation of the blog and shop areas, or for security reasons. Whatever the reason, migrating your OpenCart store to a subdirectory can be a straightforward process with the right steps.

Step-by-step guide to migrating your Opencart to a subdirectory

First, we want to explain to you briefly and concisely the multi-step migration process that will ensure your transition is seamless.

Step 1: Moving the Shop to a new subdirectory

The first step will be to move your OpenCart store to the new subdirectory you desire, which in our example will be “shop”. This will change your shop’s URL from https://bestopencartproducts/ to https://bestopencartproducts/shop/

For this step you have two alternatives:

  1. Use your hosting cpanel interface and move the files within this interface
  2. Use an ftp manager, for example, Filezilla, and perform the movements from its interface

Once the files are moved, we proceed to the next step.

Step 2: Creating the .htaccess file

Next, in your website’s root folder (https://bestopencartproducts/), you need to create a .htaccess file. This file should contain the following code:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/robots.txt$
RewriteRule ^(.*)$ /shop/$1 [R=301,NC,L]

It’s necessary to point out that in the above code, “shop” should be replaced by the name of the subdirectory you have chosen.

Step 3: Waiting time

Once you have completed the above step, it’s advisable to wait for 2 to 3 weeks.

This time is necessary for search engines to detect the change and update their databases. If you don’t wait this time, you’re risking too much to lose everything.

Step 4: Removal of the .htaccess file

After the waiting period, you can proceed to remove the .htaccess file and install the new platform in the main directory.

By following all these steps, you ensure an effective and convenient transition, something that will allow maintaining and boosting the visibility of your online store.

If after reading this article you need help in migrating your Opencart store, don’t hesitate to contact us, we will be delighted to assist you.

Frequently asked questions about the migration process

What benefits will migrating to a subdirectory bring to my OpenCart online store?

Migration can offer several benefits, including increased security, a cleaner site structure, and the ability to host multiple sites on a single domain.

Are there any risks during the migration process?

There’s always the risk of errors occurring during migration. However, with a complete backup and by carefully following the steps we’ve described, you can minimize these risks.

Can I revert back after migrating my store to a subdirectory?

Yes, if you decide, for any reason, that you want to reverse the process, you can do so by following the steps in this tutorial in reverse.


Migrating your OpenCart online store to a subdirectory is a straightforward process that can bring significant benefits to your online business. By following the instructions we’ve provided in this article, you can carry out this task in an easy and safe manner, contributing to the success and growth of your online store.

Always remember to backup your site before making any changes, and if you have any doubts during the process, don’t hesitate to seek professional help to ensure a correct and hassle-free migration. Good luck!

Scroll to Top