Page 1 of 1

[SOLVED] - How to Move Opencart From Root to Subfolder

Posted: Wed Sep 11, 2019 2:45 pm
by aarslankhan
Hi guys,
I have a novice question that you can help me easily. I have installed OC in root. I want to move it to a subfolder in the root. For example,if I have www.mysite.com, I want to move it in www.mysite.com/Subfolder. I have redirected www.mysite.com to www.mysite.com/Subfolder through htaccess in the root. What changes I need to make to config.php and admin/config.php and to htaccess in the Subfolder. Would I need to make changes to other files too in the Subfolder? How to deal with databases in www.mysite.com? Where I need to export it? How can I achieve this? I am using OC 3.0.2.0. I would be thankful for any help.
Kind Regards
AARSLAN KHAN

Re: How to Move Opencart From Root to Subfolder

Posted: Wed Sep 11, 2019 5:48 pm
by cedcommerceteam
Hello AARSLAN,
You need to do few changes in config.php & admin/config.php if you have copied your OC to subfolder,

For Example :

Your current folder path or directory :

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://example.com/opencart-3.0.3.2/upload/admin/');
define('HTTP_CATALOG', 'http://example.com/opencart-3.0.3.2/upload/');

// HTTPS
define('HTTPS_SERVER', 'http://example.com/opencart-3.0.3.2/upload/admin/');
define('HTTPS_CATALOG', 'http://example.com/opencart-3.0.3.2/upload/');

// DIR
define('DIR_APPLICATION', '/opt/lampp/htdocs/opencart-3.0.3.2/upload/admin/');
define('DIR_SYSTEM', '/opt/lampp/htdocs/opencart-3.0.3.2/upload/system/');
define('DIR_IMAGE', '/opt/lampp/htdocs/opencart-3.0.3.2/upload/image/');
define('DIR_STORAGE', '/opt/lampp/htdocs/opencart-3.0.3.2/upload/storage/');
define('DIR_CATALOG', '/opt/lampp/htdocs/opencart-3.0.3.2/upload/catalog/');
You subfolder directory where OC moved :

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://example.com/subfolder/opencart-3.0.3.2/upload/admin/');
define('HTTP_CATALOG', 'http://example.com/subfolder/opencart-3.0.3.2/upload/');

// HTTPS
define('HTTPS_SERVER', 'http://example.com/subfolder/opencart-3.0.3.2/upload/admin/');
define('HTTPS_CATALOG', 'http://example.com/subfolder/opencart-3.0.3.2/upload/');

// DIR
define('DIR_APPLICATION', '/opt/lampp/htdocs/subfolder/opencart-3.0.3.2/upload/admin/');
define('DIR_SYSTEM', '/opt/lampp/htdocs/subfolder/opencart-3.0.3.2/upload/system/');
define('DIR_IMAGE', '/opt/lampp/htdocs/subfolder/opencart-3.0.3.2/upload/image/');
define('DIR_STORAGE', '/opt/lampp/htdocs/subfolder/opencart-3.0.3.2/upload/storage/');
define('DIR_CATALOG', '/opt/lampp/htdocs/subfolder/opencart-3.0.3.2/upload/catalog/');
Please try now 7 let us know the consequences.

Thanks.
Kind Regards:

Re: How to Move Opencart From Root to Subfolder

Posted: Wed Sep 11, 2019 8:51 pm
by aarslankhan
Thanks cedcommerceteam for your help and time. I have tried your solution. Sorry but it did not work. And also my config files are different. I am confused, please guide me with respect to my config files.
My subfolder config file is

Code: Select all

define('HTTP_SERVER', 'http://www.example.com/');

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/');

// DIR
define('DIR_APPLICATION', '/home/user/public_html/catalog/');
define('DIR_SYSTEM', '/home/user/public_html/system/');
define('DIR_IMAGE', '/home/user/public_html/image/');
define('DIR_STORAGE', '/home/user/storedata1/storage/');
define('DIR_LANGUAGE', DIR_APPLICATION . 'language/');
define('DIR_TEMPLATE', DIR_APPLICATION . 'view/theme/');
define('DIR_CONFIG', DIR_SYSTEM . 'config/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');
and my subfolder admin/config.php is

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://www.example.com/admin/');
define('HTTP_CATALOG', 'http://www.example.com/');

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/admin/');
define('HTTPS_CATALOG', 'http://www.example.com/');

// DIR
define('DIR_APPLICATION', '/home/user/public_html/admin/');
define('DIR_SYSTEM', '/home/user/public_html/system/');
define('DIR_IMAGE', '/home/user/public_html/image/');
define('DIR_STORAGE', '/home/user/storedata1/storage/');
define('DIR_CATALOG', '/home/user/public_html/catalog/');
define('DIR_LANGUAGE', DIR_APPLICATION . 'language/');
define('DIR_TEMPLATE', DIR_APPLICATION . 'view/template/');
define('DIR_CONFIG', DIR_SYSTEM . 'config/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');
Please advise me how to edit my Subfolder config.php and Subfolder/admin/config.php and in which places I need to put my Subfolder.
Kind Regards and Thanks :)

Re: How to Move Opencart From Root to Subfolder

Posted: Thu Sep 12, 2019 3:32 pm
by cedcommerceteam
Hi there,

In config.file, you need to do following changes :

If your file is stored at following path /home/user/public_html/ then add your subfolder path after /home/user/public_html/ then it will be like /home/user/public_html/sub_folder_path/

Code: Select all

define('HTTP_SERVER', 'http://www.example.com/sub_folder_path/');

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/sub_folder_path/');

// DIR
define('DIR_APPLICATION', '/home/user/public_html/sub_folder_path/catalog/');
define('DIR_SYSTEM', '/home/user/public_html/sub_folder_path/system/');
define('DIR_IMAGE', '/home/user/public_html/sub_folder_path/image/');
similarly in admin/config.php file

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://www.example.com/sub_folder_path/admin/');
define('HTTP_CATALOG', 'http://www.example.com/sub_folder_path/');

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/sub_folder_path/admin/');
define('HTTPS_CATALOG', 'http://www.example.com/sub_folder_path/');

// DIR
define('DIR_APPLICATION', '/home/user/public_html/sub_folder_path/admin/');
define('DIR_SYSTEM', '/home/user/public_html/sub_folder_path/system/');
define('DIR_IMAGE', '/home/user/public_html/sub_folder_path/image/');
define('DIR_CATALOG', '/home/user/public_html/sub_folder_path/catalog/');
I hope this will work now. Try this way & let us know.

Thanks.

Kind Regards :

Re: How to Move Opencart From Root to Subfolder

Posted: Thu Sep 12, 2019 4:25 pm
by johnp
If you're using the htaccess file check that as you will probably need to add the subfolder to that. :)

Re: How to Move Opencart From Root to Subfolder

Posted: Fri Sep 13, 2019 2:24 pm
by aarslankhan
Hello cedcommerceteam,
Your soultion has helped me. I am greately thankful for this.

Re: How to Move Opencart From Root to Subfolder

Posted: Sat Sep 14, 2019 12:16 pm
by cedcommerceteam
aarslankhan wrote:
Fri Sep 13, 2019 2:24 pm
Hello cedcommerceteam,
Your soultion has helped me. I am greately thankful for this.
Hello Arslan,
Your Welcome for the feeback!
Please feel free to contact us if you face any issue in future :)

Best Regards