Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Cannot Figure Out Multiple Websites Configuration in 1.4.0.1. 
 
mrgad
Member
 
Total Posts:  60
Joined:  2008-08-29
 

I read the Wiki about how 1.4 now handles multiple websites.  It no longer requires that index.php be edited for each website you’re running.  Instead you can use—in my case—htaccess—to “direct the traffic”.

However, I’ve spent the whole day trying to troubleshoot and I can’t resolve the issue.  As a result, our store has been down the entire day.  Any help would be greatly appreciated.  Here is what we have done so far.

For reference:

our magento install is located here:  example.com/subdomain/magento/
our actual storefront website is located here:  example.com/subdomain/
the website address is subdomain.example.com
the “run code” created in Manage Stores in the control panel for this website is “website”

1. We updated to 1.4.0.1.
2. We reindexed all indices.
3. We copied the new index.php (from 1.4 install) to the example.com/subdomain folder, replacing the old version of index.php that was there from 1.3
4. Edited one line of code in this instance of index.php to point it to the correct location of Mage.php.

Changed from:

$mageFilename = ‘app/Mage.php’;

to:

$mageFilename = ‘magento/app/Mage.php’;

5. Edited htaccess in the example.com/subdomain folder by inserting these 2 lines about halfway down, right after Rewrite Engine On:

RewriteCond %{HTTP_HOST} ^(.*)subdomain.example.com
RewriteRule ^ - [E=MAGE_RUN_CODE:website]

That’s it.  Those are the 5 steps we followed.  I should also note that we did NOT change the configuration for this website in the control panel.  The unsecure base is still set as http://subdomain.example.com/magento/ and the unsecure base link is set as http://subdomain.example.com/

Clearly I’ve done something wrong, as our site now results in 404 errors.

Any help would be GRATEFULLY appreciated!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
David Oliver
Sr. Member
 
Avatar
Total Posts:  177
Joined:  2008-04-16
Cologne, Germany
 

I spent hours trying to use the new method with a second Magento “website” in a subdomain, but gave up and went back to using index.php from Magento 1.3 without any of the extra .htaccess stuff.

Anyway, are you sorted now?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mlacy
Jr. Member
 
Total Posts:  5
Joined:  2010-04-25
 

In the new version they make it very simple.

http://www.magentocommerce.com/wiki/general/multiple-website-setup

All you need to do is put the following code into you magento root folder .htaccess file

RewriteCond %{HTTP_HOST} ^(.*)example.com
RewriteRule ^ - [E=MAGE_RUN_CODE:example]

where example is the code defined for the website in the Manage Stores section. Repeat for each domain/website combination.

You do NOT need to do the step 3 and 4 that you listed.  This is no longer required.  However, you will have to now point your subdomains at the root folder you installed magento in.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hecsmac
Jr. Member
 
Total Posts:  20
Joined:  2010-03-29
 

Hi I am also struggling to work this out, I have been trying for two days now and its urgent.

On my server I have a folder with my magento installation, called: foldera then i also have a new folder called: folderb. Foldera is for maindomain.com and folderb is for anotherdomain.com.

I have created a new website in admin and called it anotherdomain.com and called the code anotherdomain. The website code for my magento instillation is base.

So in folderb i have copied the index.php and .htaccess files.

I have then added this code to the .htaccess file in foldera:

RewriteCond %{HTTP_HOST} ^(.*)base.com
RewriteRule ^ - [E=MAGE_RUN_CODE:base]

and i have added this code to the .htaccess in folderb

RewriteCond %{HTTP_HOST} ^(.*)anotherdomain.com
RewriteRule ^ - [E=MAGE_RUN_CODE:anotherdomain]

I have then edited the new index.php in folderb like this

from:
app/Mage.php

to:
../foldera/app/Mage.php

However when i go to www.anotherdomain.com it automatically changes the url in my browser to maindomain.com and goes to the other store. I have set the unsecure and secure base url for the new website to http://www.anotherdomain.com and changed the theme for this website, none of this seams to have any effect though.

This is driving me crazy, any help would be really great, Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
drazhar
Member
 
Total Posts:  48
Joined:  2010-05-11
 

I have a similar issue

i want to use www.example.com/reseller as my main site and www.example.com/reseller/wholesale as a seperate website

my htaccess looks like this

RewriteCond %{HTTP_HOST} ^(.*)example.com/reseller/wholesale
RewriteRule 
^ - [E=MAGE_RUN_CODE:wholesale]

RewriteCond 
%{HTTP_HOST} ^(.*)example.com/reseller/
RewriteRule ^ - [E=MAGE_RUN_CODE:base]

It isnt working at all. I get a “woops” when i go to wholesale

I have created a “wholesale” folder, copied the index.php and the htaccess, but i get a 404 when i try to access it

i resolved this: http://www.magentocommerce.com/boards/viewthread/193946/

 
Magento Community Magento Community
Magento Community
Magento Community
 
WHolland
Jr. Member
 
Total Posts:  2
Joined:  2010-08-16
 

Like many of you...banged my head but after two days finally figured it out! You DO have to edit one line in your index.php file
Mine was line line 75 and 75 only, leave line 78 as it is.

Copy your .htaccess and index file from your existing domain to “your-new-site-folder”

Edit the following:
index.php line 75

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE''YOUR STORE CODE, NOT YOUR WEBSITE CODE';

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

in your .htaccess add to the bottom:

SetEnvIf Host .*site.* MAGE_RUN_CODE="YOUR WEBSITE CODE, NOT YOUR STORE CODE
SetEnvIf Host .*site.* MAGE_RUN_TYPE=website # 'website' or 'store'

This worked perfect for me on 3 diff stores. I have not upgraded to 1.5 but should be the same.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top