Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Move OpenCart to a Different Folder

This guide shows how to move your OpenCart store from one folder to another, for example from a sub-folder to your main site.

Online Stores2 min read13 steps

What is an installation folder?

The installation folder is the place on your hosting where the OpenCart files live. If OpenCart is in public_html/shop, visitors go to yourdomain.com/shop. If you move it to public_html, visitors go to yourdomain.com.

OpenCart remembers its folder in two config files. After a move, you must update both. If you forget, the store breaks.

Warning: Back up all files and your database before you start. In File Manager use Compress. In phpMyAdmin use Export.

Steps

  1. Log in to the client area and open your control panel.
  2. Open File Manager.
  3. Go to the current OpenCart folder, for example public_html/shop.
  4. Select all files and folders. Click Show Hidden Files in the settings so you also select .htaccess.
  5. Click Move. Type the new path, such as /public_html, and confirm.
  6. Open the file config.php in the new folder. Right-click it and choose Edit.
  7. Change the web addresses. These lines are named HTTP_SERVER and HTTPS_SERVER. For example:
    define('HTTP_SERVER', 'http://www.example.com/');
    define('HTTPS_SERVER', 'https://www.example.com/');
    These lines tell OpenCart its public address.
  8. Change every path line that begins with DIR_. They hold the folder paths on the server. Replace the old folder name with the new one. For example, /home/user/public_html/shop/system/ becomes /home/user/public_html/system/.
  9. Save the file.
  10. Open admin/config.php and do the same. Change HTTP_SERVER, HTTP_CATALOG, HTTPS_SERVER, HTTPS_CATALOG and the DIR_ lines.
  11. Open .htaccess if you use clean addresses. Check that RewriteBase matches the new folder.
  12. Clear the cache by deleting the files inside system/storage/cache.
  13. Visit your store and your admin area. Check both load.
Tip: The exact path to your account is shown at the top of File Manager. Use it in the DIR_ lines. OpenCart 2 and older keep their cache and logs in different folders, but the steps are the same.

Quick recap

  • Back up first.
  • Move the files to the new folder.
  • Edit config.php and admin/config.php.
  • Check .htaccess and clear the cache.
  • Test the store and admin area.