InMotion Hosting Support Center
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 1.5 URL - How To
Section 2: Finding a theme for your OpenCart 1.5 Site

Support Center Login

Social Media Login

   
Social Login Joomla

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
35,728 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-09-18 7:09 pm

Hi I would like to change certian parts of my page urls. An opencart module name which shows up in the url i need hidden so how can i hide it?? I dont think its in the config file but it looks like this :

 

http://sheridangraphics.co.uk/index.php?route=tester/designer&path=&product_id=1354

 

I dont want people to know how i can hide the "tester" part so would i be able to do that??

Staff
40,817 Points
2015-09-21 11:50 am
Hello Soyeb,

This article is about changing the main domain URL in your OpenCart. You would need to know how to code an htacess rewrite rule to alter the full URL of a site. Unfortunately we do not provide custom coded solutions for such things currently.

Kindest Regards,
Scott M
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
26,063 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
40,817 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
40,817 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
n/a Points
2015-04-14 10:05 am

Thanks Scott,

Before your reply, I changed the values at the http:// point. I changed http:// to https:// and changed all defines from http://mccartneykay.com to https://mccartneykay.com and left the value http:// alone. It is working on all pages except the home page but when the page is refreshed it changes from http://mccartneykay.com to https://mccartneykay.com. Any ideas how to make it resolve to https://mccartneykay.com by default? 

Best regards, 

Chris

Staff
35,728 Points
2015-04-14 1:00 pm
Hello Chris,

You probably need to change ONE more definition. If you have defined the HTTP path to be HTTP, then it will show with HTTP, not HTTPS. So change this entry and then your site won't load up in HTTP.

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

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


If that doesn't work, then check out this tutorial on forcing SSL with the .htaccess file.

Kindest regards,
Arnel C.
n/a Points
2015-04-19 3:52 pm

I have looked everywhere I can think of to find an area that may have been missed and without avail. I tried to force it in the .htaccess but when I did, it brought the whole site down. Then I removed the code to force it to SSL so as to bring it back to where I was.

Any other Ideas?

My site is mccartneykay.com see for yourself. Once loaded it doesnt show SSL but once reloaded/refreshed or selecting another page, it will resolve to SSL

Thanks,

Chris

Staff
40,817 Points
2015-04-20 9:19 am
Hello Chris,

I definitely see the behavior and understand what you are saying. With our testing site, we are not seeing that same behavior. Unfortunately, without access to your site to test, we do not have any other suggestions. You may want to contact your particular hosting support to see if they can look at the individual code on the account.

Kindest Regards,
Scott M
n/a Points
2015-04-20 9:32 am

Hello Scott,

I just got off the phone with my host. The host was not able to resolve the issue either and tried to place this code on the top line of the .htaccess and adding my URL in where needed.

RewriteEngine on

rewritecond %{http_host} ^coolexample.com [nc]

rewriterule ^(.*)$ http://www.coolexample.com/$1 [r=301,nc]

My host recommended that I contact a developer to resolve.

I suppose we are kinda stuck with it if you or anyone else can not help.

 

Thanks,

Chris

Staff
40,817 Points
2015-04-20 9:49 am
Hello Chris,

I see that coolexample.com is an example domain owned by your host, so be sure that you replace that with your own domain name. That code template however will simply force the www, but not the https.

Did you say you tried the examples we have on our article about forcing ssl?

Kindest Regards,
Scott M
n/a Points
2015-04-20 10:48 am

Hi Scott,

Yes, we entered our domain anywhere coolexample.com is in the code and changed the template code to https from http and removed the www. We tried different configs but nothing there had any effect.

I tried to force SSL as in your artical as well. Still nothing. The domain shows secured, just not visually when site is loaded.

 

Thanks,

Chris

n/a Points
2015-08-14 4:08 pm

Nice one! Clean!

n/a Points
2015-08-25 7:18 am

my domain name is http://www.quresons-fitness.com/

when i open any product it looks like that 

http://www.quresons-fitness.com/index.php?route=product/product&product_id=63

but i want it to be shown like thathttp://www.quresons-fitness.com/belts

How is it possible?

Staff
10,077 Points
2015-08-25 9:02 pm
Hello Saif,

You can enable SEO urls by going to System > Settings > Edit > Server from within the admin dashboard. There is an option for Enable SEO Urls, just enable that and refresh.

Best Regards,
TJ Edens
n/a Points
2015-09-21 1:33 pm

Thanks TJEdens

n/a Points
2016-01-20 3:37 pm

In the DEFINE's should we include the 'www' or not?

// HTTP define('HTTP_SERVER', 'https://example.com/'); // HTTPS define('HTTPS_SERVER', 'https://example.com/');

OR

// HTTP define('HTTP_SERVER', 'https://www.example.com/'); // HTTPS define('HTTPS_SERVER', 'https://www.example.com/');

 

Thanks in advance!

Staff
35,728 Points
2016-01-20 4:56 pm
Hello Chris,

Generally, the SSL includes the WWW as part of the link, but it just depends on what URL you want the customers to see. So, if you want WWW to appear when it jumps to the HTTPS version of the link, then you should include it.

I hope this helps to answer your question, please let us know if you require any further assistance.

Regards,
Arnel C.
n/a Points
2016-04-05 10:55 am

Hi! Thanks for the post. I have change the urls of my store but now I cant see the images!! :(

 

What can I do?

Staff
26,063 Points
2016-04-05 11:33 am
Hello Carlos,

Thank you for contacting us. Can you provide a link to the site with images missing?

Thank you,
John-Paul
n/a Points
2016-04-06 4:56 am

http://farmacialopezmiranda.com/

 

Thanks!

Staff
35,728 Points
2016-04-06 11:35 am
Hello Carlos,

The images look correct on that site - at least for the front page. If you're getting 404s, then it's possible that you need to TURN OFF caching or search engine friendly URLs. Once these have been turned off, click on save, or exit the administrator. Then go back in and re-enable them. This allows the database to re-written with the updated URLs if the site has been moved.

If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2016-04-07 5:50 am

Hello Arn. Thank you very much for the help.

Images now work well (I had forgotten to add the last "/" in the urls of the config file), but I still have 404 errors on pages.

I turned off the friendly urls and have left the panel and the products are displayed without problem. Its OK! But, then I re-enter and activate the friendly urls and returns the 404 error :(

Staff
6,431 Points
2016-04-07 12:15 pm
Did you try clearing your cache after turning on the Friendly URLs?
n/a Points
2016-10-07 8:12 pm

Please help,

I made a test link of the open cart website . The live website link is ******.com

The test link website URL is *****.com/testlink

Issue => The test link is not working properly.

 When you will visit the test link, the products will be switched on the live URL on the  second product

Kindly let me know if there is any confusion to understanding.

Thank you

Staff
40,817 Points
2016-10-10 9:09 am
Did you copy the site over or did you do a fresh install and then add the content? What is your purpose with the subfolder? Are you looking to move your site or were you trying to create a separate test site? Also, what specific version of OpenCart are you using?
n/a Points
2016-10-16 11:44 am

I did what was showed above....changed all lines in both config.php files but all it does is take me to the actual web page, not my open cart admin site and now I cannot access my open cart admin site

Thanks

Staff
11,901 Points
2016-10-17 6:55 am
What version of OpenCart are you running?
n/a Points
2016-10-27 9:37 am

I got it to change finally thanks...just didnt change the name in the root directory

n/a Points
2016-11-19 2:42 pm

I installed OpenCart so that is under a folder, like this: mydomain.com/oc/.  Is it possible to leave the installation like that, but have the user go to mydomain.com/ and see my store, without having to type the extra oc/ at the end?

Staff
40,817 Points
2016-11-21 6:39 pm
You can if you set up a redirect for your main domain to mydomain.com/oc.

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.

38 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!