This is a tutorial on how to change your OpenCart URL. There are various reasons for changing your website's URL, such as testing our website on your Temporary URL, or you may just want to use a different domain name for your site.

We will walk you through editing and updating 2 .php files in order to accomplish this.

Changing Your URL:

  1. Using FTP or File Manager, navigate to the root of your OpenCart installation, and locate a file titled config.php.
  2. Edit the config.php file, and locate the lines that look like this:

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

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

  3. Change the existing URL (I hilighted the part you need to update in red) to your new domain name, then save the modification.
  4. Now, locate and edit the config.php file located in the: /admin folder. You will see several lines that look like this:

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

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

  5. Update the existing URL (I hilighted the part you need to update in red) with your new one, then save what you have done. Your OpenCart URL has now been changed in the config.php files, and your site will function on the new address.


Congratulations, now you know how to change your URL in OpenCart by modifying the config.php files!
You are viewing Section 1: Change OpenCart URL - How To
Section 2: Finding a theme for your OpenCart Site

Support Center Login


Social Media Login

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
2013-11-12 10:56 am
Thanks alot for this tutorial. It really helped me alot. Very graphic and useful
n/a Points
2014-11-26 7:05 pm

Thanks for this post. I think this is what I was looking for. Just another question.

I installed opencart on a subdomain sub.domain.co.uk and currently the nameservers for the sub.co.uk arent updated to point to sb.co.uk (so that I can build it)

The store URL in settings show as http://sub.domain.co.uk. When I finish building the site, if I modify the URL in config to sub.co.uk and update the nameservers, will the store be functioning ok ? or should I update NS and install OC after that ? A reply is much appreciated. Cheers.

:-)

Staff
22,245 Points
2014-11-26 8:14 pm
Hello Vibz,

Thanks for the question. As long as the config is pointing to the correct URL and the files and database are accessible, then there should be no problem with running your OpenCart installation. If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2015-01-10 8:00 am

hii i just want to display weight on product page on open cart 2.0.1.1 how can i do that please help me out. i have tried many options available on google do you have any other option. eg (weight=500g or weight= 1kg)

Staff
14,278 Points
2015-01-12 2:06 pm
Hello Raj,

Thank you for your OpenCart question. I have seen people put the product weight in the description, but I could not find a way to display the weight setting on the page by default.

This means you would have to custom code a solution, or use a 3rd party extensions such as Show Dimension and Weight.

Thank you,
John-Paul
n/a Points
2015-04-13 7:00 pm

I understand that this is the proper way to change the opencart url, However in my config.php it appears as below in the //https area. The same as well in the admin folder.(Without my URL). Any Ideas as to where to go on this? I havent found anyone else with this issue yet and or a resolve. I am using 2.0 opencart. If I try to input the address, it creates an error. 

// HTTPdefine('HTTP_SERVER', 'http://example.com/admin/');define('HTTP_CATALOG', 'http://example.com/');// HTTPSdefine('HTTPS_SERVER',define('HTTPS_CATALOG',

Staff
24,690 Points
2015-04-13 7:18 pm
Hello Chris,

You will need to change the the URL to the new one wherever you see it, so in both the base config.php and the one located in the admin folder.

Kindest Regards,
Scott M
n/a Points
2015-04-13 7:40 pm

This is what I see,

What do I need to change?

// HTTP

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

define('HTTP_CATALOG', 'http://mccartneykay.com/');

define('HTTP_IMAGE', 'http://mccartneykay.com/image/');

define('HTTP_ADMIN', 'http://mccartneykay.com/admin/');

 

// HTTPS

define('HTTPS_SERVER', HTTP_SERVER);

define('HTTPS_CATALOG', HTTP_CATALOG);

define('HTTPS_IMAGE', HTTP_IMAGE);

define('HTTPS_ADMIN', HTTP_ADMIN);

Staff
24,690 Points
2015-04-13 10:13 pm
Hello Chris,

Currently the HTTPS versions are simply using what is defined in the HTTP version. You can replace the values in the HTTPS for your actual http URLs. For instance, change:
define('HTTPS_SERVER', HTTP_SERVER);
to:
define('HTTPS_SERVER', 'https://mccartneykay.com/');

Note that I used your https:// URL in place. That should help you.

Kindest Regards,
Scott M

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

9 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!