Moving the storage directory outside of the OpenCart root directory


Site backup functionality does not cover directories that are moved outside the site's root directory. Such directories will only be available in backup hostingaccount.

In OpenCart, to make the site files more secure, the directory storage can be taken out of bounds site root directory... This is to ensure that the directory cannot be accessed via HTTP.

This transfer can be done in two ways:

Automatic movement is available under the following conditions:

  • Catalog storage is in root directory of the site.
  • OpenCart version or higher is used.
  • No changes were made to OpenCart settings.
  • Directory movement functionality storage provided by the CMS... In this regard, there may be additional conditions for its correct operation.

For automatic catalog transfer storage do the following:

  1. Go to section "Dasboard" in the left pane:
  2. If all the conditions are met, a modal window will appear with a proposal to move the catalog storage outside the site directory. To move the directory press "Move":
To transfer a directory storage outside the root directory of the site, do the following:
  1. Through filemanager or any FTPclient transfer directory storage of site root directory one level up — to the directory with the name of the main domain (so that it is accessible along the path example.com/storage/, where example.com — the name of the main domain).
  2. Edit config files OpenCart or use universal config filesby changing the line:
    define('DIR_STORAGE', DIR_SYSTEM . 'storage/');

    To the next one:

    define('DIR_STORAGE', '/home/user/example.com/' . 'storage/');

    Instead user indicate the name hosting accountand instead of example.com — the name of the main domain without subdomains.