2.13.4.24. Moving the storage directory outside of the OpenCart root directory
Warning!
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 3.0.3.0 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:
- Go to section "Dasboard" in the left pane:
- 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:- 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 pathexample.com/storage/
, whereexample.com
— the name of the main domain). - 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 ofexample.com
— the name of the main domain without subdomains.