How to set up an alias domain in CS-Cart

In this article, you will learn how to set up an alias domain through cPanel. Domain alias means an alternate name for another existing domain. To set up a domain alias, it must be a registered domain name. 

For example, let’s say you use the domain name examplestore.com for your website, but you also own the domain name examplestore2.com. You want examplestore2.com visitors to land at the same website used by examplestore.com. You can easily do this by setting up examplestore2.com as an alias domain.

cPanel domain alias setup

Before you can use an alias with your CS-Cart store, you’ll need to set up your alias in cPanel

Note: In old versions of cPanel, a domain alias can also be called ‘Parked Domain’, but its functions and steps are the same.

1. Log into your cPanel

2. Scroll down to the Domains section and select Aliases.

cPanel domain alias setup

3. Enter the alias domain name in the Domain field and click on Add Domain.

How to set up an alias domain

You will get a success message. 

How to update the CS-Cart configuration file

Once your cPanel domain alias setup is done, you’re ready to configure CS-Cart.

1. In cPanel, click File Manager.

cPanel domain alias setup

2. In the directory tree, click the root directory of your CS-Cart installation. 

3. Right-click on config.local.php and select Edit.

Set up alias domain with cPanel

  1. A confirmation dialogue box will open, click Edit to open the file.
  2. In the editor, locate this text:

 

// Host and directory where cs-cart is installed on non-secure server
$config['http_host'] = 'www.your_domain.com';
$config['http_path'] = '/your_cscart_directory';

// Host and directory where cs-cart is installed on secure server
$config['https_host']= 'www.your_domain.com';
$config['https_path'] = '/your_cscart_directory';

6. Add two forward slashes (//) to the beginning of each line that doesn’t already start with two slashes. It should look like this:

// Host and directory where cs-cart is installed on non-secure server
// $config['http_host'] = 'www.your_domain.com';
// $config['http_path'] = '/your_cscart_directory';

// Host and directory where cs-cart is installed on secure server
// $config['https_host']= 'www.your_domain.com';
// $config['https_path'] = '/your_cscart_directory';

Adding slashes change these lines from active code to comments. This is safer than deleting the lines because it’s much easier to undo the change if you make a mistake.

7. Below the lines of code that you changed to comments, add this code:

// Host and directory where cs-cart is installed on usual server
$config['http_host'] = $_SERVER['HTTP_HOST'];
$config['http_path'] = '/your_cscart_directory';

// Host and directory where cs-cart is installed on secure server
$config['https_host'] = $_SERVER['HTTPS_HOST'];
$config['https_path'] = '/your_cscart_directory';

8. Click Save Changes at the top-right menu. 

How to set up an alias domain

Note: The $_SERVER[‘HTTP_HOST’] and $_SERVER[‘HTTPS_HOST’] variables must exist on your server.

If you need help with your HostPapa account, please open a support ticket from your dashboard.

Was this article helpful?