This tutorial shows you how to move OpenCart 2.x. installation from the sub-directory to the root.
The following steps should be performed in order to trasnfer the site to the root directory:
First, open server files and locate the subfolder with the current installation. That is ‘test’ in our case.
Back up the files. Keep the .zip file somewhere in your computer, it can be used to restore the original website in case it is reuqired.
Transfer the content of the subfolder to the root directory. Use drag-and-drop tool in your FTP client for this. Once the transfer is completed you can delete the subfolder as it is not going to be used further.
Next, edit config.php file from the root of installation. Use any available HTML editor for that. Remove all the references of the subfolder from the site link – \test. Make sure that lines are ended up with ‘ / ‘ symbol:
Then open ‘admin’ folder in the new installation root and edit config.php file from there. Use the same HTML editor for that. Remove all the references to the subfolder from the site link – \test within entire file. Make sure that lines are ended up with / symbol.
Save changes once done editing. Now check the new site’s URL. The website will appear under the root direction properly.
Note: only sever files are to be used, the Database should not be modified.
Feel free to check the detailed video tutorial below: