A good domain name or URL means a lot to your OpenCart online store. In this tutorial you will find the steps how to change Opencart URL in an easy way. There are quite many reasons for changing your website's URL, such as testing your website on the temporary URL before going live, or you may just want to use a different domain name for your site.
You may want to change OpenCart URL from a subdomain to a root domain or from a subfolder to your root folder. No matter what reason you have to update OpenCart URL, you can do that following the instructions below.
NOTE: Before proceeding with any changes, make sure that you generate a full backup of your website. If you've created your site using Softaculous script installer, feel free to refer to this guide as well (step #4 – Backup software).
Opencart CMS defines your store URL in two configuration files (config.php) located in root and admin folders of the Opencart installation separately. Follow these steps to change two OpenCart config.php files one by one.
Update Opencart URL in the root folder
1. Log into your cPanel account.
2. Open File Manager menu located in Files section:
3. Navigate to the root folder of the Opencart installation, right-click on config.php and used Code Edit option:
4. Open the file and edit its source code online. You will need to locate and edit the following lines:
5. Instead of the old URL address, enter the new one and hit the Save button. In our case, config.php file will look like this after the change:
Update OpenCart URL in the admin config.php
1. Now, locate and edit the config.php file located in the /admin folder inside the Opencart installation. You can use Code Editor for editing as well:
2. You will see several lines that look like this:
3. Replace all the outlined URLs with the new domain name you would like to set for the Opencart installation and save the changes. In our case, the code looks like this:
Your OpenCart URL has been changed in the config.php files for now, and your site will function under the new domain name.
NOTE: In case you are transferring the installation from a different cPanel account, you will need to update the path to the corresponding files in both config.php files as well.
That's it!
Need any help? Contact our HelpDesk