How to move the storage directory in OpenCart - automatically or manually

If you just installed OpenCart and logged in to it's admin panel you probably noticed that OpenCart asks you to move the storage directory for safety reasons. if you have no idea why it shows up and what should you do with it, you're in the right place to find out.

Here's what you'll learn:

What is storage directory in OpenCart

Storage directory contains temporary files (cache), some vendor files and extension modification files in OpenCart.

For example, if you just installed an OCMOD extension which adds additional code to one of the theme files, then system automatically creates a duplicate of the original file in the storage folder. That duplicate file has all the modifications from OCMOD, so core OpenCart files are never modified.

When the system will need the theme file, first it will check if there is a modified version if it in the storage folder. If there is, it will load the modifed version. If modification file not found, the system will automatically load default OpenCart file.

How to move OpenCart storage directory outside of public directory automatically

Storage folder might contain any sort of modified code, especially if you use lots of third party extensions. So it's safer to hide this directory from public view.

If you have a correctly set up hosting server, there won't be much to do to accomplish that. Select Automatically Move option, and OpenCart will offer you a safe place to move storage directory outside of public view. By default it's one directory up from public, public_html or www directories (depending on your hosting server configuration).

opencart move storage directory automaticallySo once you select Automatically Move, and then click a Move button, the storage directory should be safely moved, and the security notification should be gone.

If for some reason you might want to name storage folder differently (for example if you already have folder named storage there), you may do it before hitting Move button.

Moving OpenCart storage directory manually

In case your hosting account has limited rights or there are other limitations in your server, and moving storage directory automatically does not work, you can move the storage folder manually.

Here's how you do it (the same information is available in the security notification when you select Manually Move):

  1. Move /YOUR SERVER DIRECTORY LIST/public_html/system/storage/ to

/YOUR SERVER DIRECTORY LIST/storage/ using FTP software like Filezilla. Just open the directory, and move the directory from one place to another.

  1. Edit public_html/config.php file: change define('DIRSTORAGE', DIRSYSTEM . 'storage/'); to define('DIR_STORAGE', '/YOUR SERVER DIRECTORY LIST/storage/');

  2. Edit public_html/admin/config.php file: change define('DIRSTORAGE', DIRSYSTEM . 'storage/');

    to define('DIR_STORAGE', '/YOUR SERVER DIRECTORY LIST/storage/');

If you have no idea how /YOUR SERVER DIRECTORY LIST/ should look like you will see working examples in other OpenCart config.php file settings.

Here's the exact example from my test server:

opencart change DIR_STORAGE