This tutorial guides you through setting up Magento Multi-Store on Shared Hosting with cPanel with the “parked domain” method. The set-up has been tested on our servers and works perfectly with all TerraNetwork hosting accounts. Any problems, feel free to contact support and we can take a look.
Shared Hosting Caveat: Whilst it’s perfectly possible to run Magento on Shared Hosting it does require more resources than other carts. If your shop gets busy or you have a large number of SKUs, then you may wish to consider an upgrade to Semi-Dedicated or Dedicated Hosting.
The set-up has been tested with Magento Community Edition 126.96.36.199 on Shared Hosting with cPanel on PHP5.3.
- Adding another shop in Magento
- Adding a parked domain to cPanel
- Modifying .htaccess
- Setting up SSL for checkout
Adding another shop in Magento
First off we need to add a second shop in Magento. We’re using a dummy name “example.com”. Please replace with the real domain you wish to us.
Create Root Category
- Log into your Magento admin
- Go to the Catalog tab and select “Manage Categories”
- Click on the “Add Root Category” button on the left
- For “Name” enter example.com. Set the dropdown for “Is Active” to “Yes”.
- Click “Save Category” button.
- Go to the “Systems” tab and select “Manage Stores”.
- Click on the “Create Website” button.
- For the “Name” enter example.com and for the code example. The code will be important later when we need to modify .htaccess.
- Click on the “Save Website” button.
- Click on the “Create Store” button.
- For the “Website”, select example.com from the dropdown. For the “Name” enter “Example” or any value of your choice. For the “Root Category” select example.com from the dropdown.
- Click on the “Save Store” button.
Create Store View
- Click on the “Create Store View” button.
- For the “Store” select the store you created in the last step, in our case Example. For “Name” enter Example View. For “Code” enter example_view. Set “Status” to “Enabled”.
- Click on the “Save Store View” button.
Change Base URL
- Go the “System” tab and select “Configuration”.
- For “Current Configuration Scope” (located near top left) change the dropdown menu from “Default Config” to example.com
- Select “Web” from the left sidebar under the “General” section.
- For both the Unsecure and Secure sections, uncheck the “Use Default” box next to the Base URL; and enter the URL for your own shop example.com. Make sure to include the trailing backslash.
- Click the “Save Config” button.
Modify URL redirecting
- Still under “System -> Configuration” change the “Current Configuration Scope” to “Default Config”.
- Select “Web” from the left sidebar under the General section.
- For “URL Options -> Auto-redirect to Base URL” set to “No”.
- Click the “Save Config” button.
Adding a parked domain to cPanel
- Change the domain’s DNS name servers to your servers. If in doubt, ask your hosting provider for help.
- Log into your cPanel and go to “Domains -> Parked Domains”
- Add the domain example.com and click “Add Domain”
- Either log into your cPanel and go to “Files -> File Manager” or connect to your site via an FTP program.
- Navigate to /home/USER/public_html/.htacess (where USER is your cPanel username).
- Add to the file the following lines as below. The “Host” is the main part of your domain name. “CODE” is the website code you defined in Magento admin. RUN_TYPE should always be “website”.
SetEnvIf Host .*example.* MAGE_RUN_CODE=example SetEnvIf Host .*example.* MAGE_RUN_TYPE=website
- Save the file and if you using FTP, upload to your site
If all has gone to plan, then you will now have the same instance of Magento running on two separate domain names.
Setting up SSL Certificates for Checkout
With the set-up as described above, the only option if you need an SSL Certificate for checkout is to go for a Multi-Domain cert. Multi-domain SSL certificates allow for one cert to be applied to separate domain names on 1 IP. In the past these used to be prohibitively expensive; but prices have tumbled dramatically and are now feasible even for smaller shops.
Multi-Domain Certs should not be confused with WildCard SSL Certs. WildCard covers sub-domains (www.mydomain.com, shop.mydomain.com). Multi-Domain Certs cover separate domain names (mydomain.com, myothershop.com). When ordering a Multi-Domain Cert please bear in mind that www.mydomain.com and mydomain.com will be counted as 2 domains.
So there you have it – a Magento multi-shop set up with secure checkout on a Shared Hosting account. And for customers of TerraNetwork, if you run into any issues, feel free to drop us a support ticket, we’re here to help!