We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.

Tutorials
More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsosCommerce

How to move to a different subdomain

Linux KVM Hosting
USA VPS
Linux Cloud Server
cPanel KVM
Brazil VPS
Ubuntu VPS
Germany Cloud Servers
Windows Cloud Server
KVM VPS
OpenVZ VPS

Lets say we are planning to move our online commerce website to a different subdomain. It should be pretty easy to do this as basically we can use any domain or subdomain with osCommerce.

Once we are ready to move to another subdomain, we can start by creating that subdomain itself. Subdomain can be easily created in web hosting server control panel at subdomain management section. For example, we are planning to use new subdomain new.domain.com while old is old.domain.com. In this case, we will need to create subdomain new.domain.com and copy existing files from old.domain.com.

Moving files from one directory to another is also not a hard thing. For this reason we can use file manager through server control panel or FTP. Since we are using subdomains for our store URL, both directories should be located in domain public_html directory. Most likely we can just copy files from old directory to the new one.

Once moving is done, we shouldn’t miss one important thing. Like every content management system, osCommerce has it’s configuration file in which website URL is defined. After moving website to the new directory, the website itself still uses old URL. Therefore, we will need to edit configuration file in order to set new subdomain.

Login to the hosting account and access the directory where osCommerce files are located. Then open file located at “includes/configure.php” and find the following lines.

1
2
3
4
define('HTTP_COOKIE_PATH', '/old/');
define('HTTPS_COOKIE_PATH', '/old/');
define('DIR_WS_HTTP_CATALOG', '/old/');
define('DIR_WS_HTTPS_CATALOG', '/old/');

Change ‘/old/’ to ‘/new/’ and save the file to apply the changes. Now we should be able to browse the store frontend by using new subdomain. However, if we will try to access admin panel, it ¬†might throw error about non-existing path. This is due to another configuration file which defines which URL should be used to access admin area. To change the URL for admin access, open file “admin/includes/configure.php” and find the following lines.

1
2
3
4
define('DIR_WS_ADMIN', '/old/admin/');
define('DIR_FS_ADMIN', '/home/username/domains/domain.com/public_html/old/admin/');
define('DIR_WS_CATALOG', '/old/');
define('DIR_FS_CATALOG', '/home/username/domains/domain.com/public_html/old/');

Simply replace “old” with “new” in the lines and save the file as well. From now we should be able to access admin backend without any errors. The process is completed – osCommerce has been moved to a different subdomain.

Ubuntu VPS
cPanel KVM
OpenVZ VPS
Linux Cloud Server
KVM VPS
Linux KVM Hosting
USA VPS
Germany Cloud Servers
Windows Cloud Server
Brazil VPS
Rate this Tutorial:
No Comments Leave a Comment
Leave a Comment

Other (192)

Popular Keywords