OpenCart is an open source application and can be a target for hackers because they already know the structure of the database, folders/files and how the source code works.

One of the easiest ways to secure the OpenCart admin panel is to rename the /admin/ directory. This change will "hide" the directory of automated tools and hackers that specifically search for the "admin" directory of OpenCart. Follow the steps below to change the /admin/ name of the directory.

Remember that once you do this, you will need to use the new path to access the OpenCart admin panel.

  1. Log in to cPanel
  2. Click on FileManager
  3. Navigate to the location where you installed OpenCart, right click on the admin directory and select Rename
  4. Fill in the new directory name
  5. In the renamed directory, open the config.php file and replace /admin with the name given to the directory in step 4

In Red are the admin instances that need to be changed:

// HTTP
define('HTTP_SERVER', 'http://test.domain.com/opencart/admin/');
define('HTTP_CATALOG', 'http://test.domain.com/opencart/');

// HTTPS
define('HTTPS_SERVER', 'http://test.domain.com/opencart/admin/');
define('HTTPS_CATALOG', '>http://test.domain.com/opencart/');

// DIR
define('DIR_APPLICATION', '/home/userna5/public_html/opencart/admin/');
define('DIR_SYSTEM', '/home/userna5/public_html/opencart/system/');
define('DIR_DATABASE', '/home/userna5/public_html/opencart/system/database/');
define('DIR_LANGUAGE', '/home/userna5/public_html/opencart/admin/language/');
define('DIR_TEMPLATE', '/home/userna5/public_html/opencart/admin/view/template/');
define('DIR_CONFIG', '/home/userna5/public_html/opencart/system/config/');
define('DIR_IMAGE', '/home/userna5/public_html/opencart/image/');
define('DIR_CACHE', '/home/userna5/public_html/opencart/system/cache/');
define('DIR_DOWNLOAD', '/home/userna5/public_html/opencart/download/');
define('DIR_LOGS', '/home/userna5/public_html/opencart/system/logs/');
define('DIR_CATALOG', '/home/userna5/public_html/opencart/catalog/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'user_test');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'user_testdb');
define('DB_PREFIX', 'oc_');

6. Save the file

7. Test the new administration link and its proper functioning.

Was this answer helpful? 0 Users Found This Useful (0 Votes)