February 27, 2020

cm-mini

Thinking Magento

Magento - Multiple Domains Using a Single SSL

The following is for version 1.3X - See below for changes to work in 1.4x - 1.7

This tutorial assumes you have already successfully setup a multi domain website.

Today we were confronted with a problem that quite literally left us all stumped. How on earth do we get several domains to use the same secure url. Being not so bright we forgot that sessions and cookies are going to be stored for the one url and that if you transfer directly over to the secure url, you're going to be left without a paddle and each time it redirects to an empty shopping cart.

1.3x

So to combat this you'll need to create a directory in your root directory that has the same name as the url. http://www.store2.com

Example being

httpdocs is your main directory for your magento installation

httpdocs/store2 is going to be where you will place the following.

A copy of  your index.php file with two adjustments. The following needs to be adjusted to look like this;

$mageFilename = '../app/Mage.php';
Mage::run('WEBSITE CODE', 'website');

Also make a copy of your .htaccess file and place that in the folder.

Now go to your web configuration settings.
Switch to website 2.

After switching to website to, on the secure base_link_url and set it to {{secure_base_url}}store2/
(store2 being the directory you created)

Thats it, now everything will correctly go to the secure url.

1.4x - 1.7x

httpdocs is your main directory for your magento installation

httpdocs/store2 is going to be where you will place the following.

A copy of  your index.php AND also the .htaccess file in the root directory

The index.php file in

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'store2';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';

In the WEB configuration of store2 (Use the top left drop down to get there)

Set Use SID's to YES

Set secure base_link_url and set it to {{secure_base_url}}store2/
(store2 being the directory you created)

SAVE

Now test out to see if adding an item to your cart and pressing checkout will take you to the correct SSL OnePageCheckout