How To Setup Multiple Magento Stores (Subdomain Method)
Posted: Mon Oct 03, 2011 5:03 pm
For this method, we'll pretend we own mall.com, and it's setup as a portal that links to the various shops within the mall. Magento will be installed on the mall.com domain, and all of the shops will be in subdomains, e.g.:
Here's how we would set this up for the shoes subdomain:
1 Login to cPanel for your domain, and click on the Subdomains icon.
For the Subdomain, we'll enter shoes. cPanel will automatically fill in the next field, so remove public_html/ from the Document Root field, leaving us with just shoes. This step isn't required, but for organizational purposes, it makes more sense.
2 Click the Create button.
3 Login to your site via SSH, and go to the directory that we previously set in the Document Root field above when creating our subdomain. In our case, we would do the following:
5 Copy the index.php and .htaccess file from the directory where Magento is installed, which would be in our root web directory:
6 Open up the index.php file that we just copied over and replace the following line of code:
…with the following:
7 With the index.php file still open, look for this line (it's the last line of the file):
…and right before this, we're going to add the following code:
8 Lastly, we need to create symbolic links to point to a few directories:
Here is the link to My past post about adding Domains to Magento stores, Which has the other methods
https://robot.lk/viewtopic.php?f=74&t=2813
Code: Select all
shoes.mall.com
Shirts.mall.com
1 Login to cPanel for your domain, and click on the Subdomains icon.
For the Subdomain, we'll enter shoes. cPanel will automatically fill in the next field, so remove public_html/ from the Document Root field, leaving us with just shoes. This step isn't required, but for organizational purposes, it makes more sense.
2 Click the Create button.
3 Login to your site via SSH, and go to the directory that we previously set in the Document Root field above when creating our subdomain. In our case, we would do the following:
Code: Select all
cd shoes/
Code: Select all
cp ../public_html/index.php ../public_html/.htaccess .
6 Open up the index.php file that we just copied over and replace the following line of code:
Code: Select all
$mageFilename = 'app/Mage.php';
Code: Select all
$mageFilename = '../public_html/app/Mage.php';
Code: Select all
Mage::run($mageRunCode, $mageRunType);
Code: Select all
$mageRunCode = 'shoes';
$mageRunType = 'website';
Code: Select all
ln -s ../public_html/app ./app
ln -s ../public_html/errors ./errors
ln -s ../public_html/includes ./includes
ln -s ../public_html/js ./js
ln -s ../public_html/lib ./lib
ln -s ../public_html/media ./media
ln -s ../public_html/skin ./skin
ln -s ../public_html/var ./var
https://robot.lk/viewtopic.php?f=74&t=2813