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, 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

Magento Forum

Cannot Figure Out Multiple Websites Configuration in 
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:
our actual storefront website is located here:
the website address is
the “run code” created in Manage Stores in the control panel for this website is “website”

1. We updated to
2. We reindexed all indices.
3. We copied the new index.php (from 1.4 install) to the 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’;


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

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

RewriteCond %{HTTP_HOST} ^(.*)
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 and the unsecure base link is set as

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
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
Jr. Member
Total Posts:  5
Joined:  2010-04-25

In the new version they make it very simple.

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

RewriteCond %{HTTP_HOST} ^(.*)
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
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 and folderb is for

I have created a new website in admin and called it 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} ^(.*)
RewriteRule ^ - [E=MAGE_RUN_CODE:base]

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

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

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



However when i go to it automatically changes the url in my browser to and goes to the other store. I have set the unsecure and secure base url for the new website to 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
Total Posts:  48
Joined:  2010-05-11

I have a similar issue

i want to use as my main site and as a seperate website

my htaccess looks like this

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

%{HTTP_HOST} ^(.*)
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:

Magento Community Magento Community
Magento Community
Magento Community
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 */

/* 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_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