Reputation: 135
I got windows server 2008 r2 standard virtual server with godaddy.
I have magento community 1.6.1.0 deployed under IIS 7.5 and it is working fine.
I tried to follow this link to use one backend to manage multiple website
http://www.magentocommerce.com/knowledge-base/entry/overview-how-multiple-websites-stores-work
I have created a foolder in the same level as the base magento install folder copy index.php and .htaccess file here, modify index.php to Mage::run(’mysite1’, ‘website’); create a new website in IIS and pointed to this folder configure the web tab for the scoop of this new website to configure the base url and secure base url
problem is that when i visit the new domain, it always redirect to the base website the default magento store.
i did a bit search, some post said “redirect to base url option”, but it is nowhere to be found. i also tried to set “Auto-redirect to Base URL” to no, but it is not helping.
can anyone help me out of this?
thanks
Upvotes: 1
Views: 1412
Reputation: 5400
It is meant to be done via the .htaccess file. You should add the following code at the bottom:
# domain1.com
SetEnvIf Host domain1\.com MAGE_RUN_CODE=domain1
SetEnvIf Host domain1\.com MAGE_RUN_TYPE=website
# domain2.com
SetEnvIf Host domain2\.com MAGE_RUN_CODE=domain2
SetEnvIf Host domain2\.com MAGE_RUN_TYPE=website
The MAGE_RUN_CODE must correspond to the website code you have entered in the Magento backoffice when creating that website.
Upvotes: 0
Reputation: 46
You don't need a different index.php
if your main site is www.mainsite.com and is "mainsite" in Magento AND your new domain is www.anothersite.com and is "anothersite" then put this code in your index.php :
switch($_SERVER['HTTP_HOST']) {
case 'www.mainsite.com' :
Mage::run('mainsite', 'website');
break;
case 'www.anothersite.com' :
Mage::run('anothersite', 'website');
break;
default:
Mage::run();
}
Personally I prefer to use Mage::run('anothersite', 'store');
Now - VERY IMPORTANT - you need to go into Magento config where you put the FRONT and BACKEND URLS in and switch to the new website level. You can then override the default and put in the new domain.
Hope this helps - if you need further expansion on the solution please let me know
Barny
Upvotes: 3