title: Magento setting up 2 stores on1 domain and 1 sub-domain with 1 install
body: <p>I know the Magento community forum would be a better place to post this but every time I post something there, no one answer.</p>
  
  <p>First let me explain my setup. I have 1 install on magento 1.8 on my main site, let’s call it domain1.com. This store is working fine and almost ready to go. Now I need another store on a subdomain, let’s call is store.domain2.com.</p>
  
  <p>I’ve check a lot of forums and tutorial and I still can’t figure out what my problem is. Here’s what I’ve done so far.</p>
  
  <p>Step 1, I create my subdomain store.domain2.com and make it point at my magento folder which is domain1/magento on my server.</p>
  
  <p>Step 2, I create my new root category I called domain2.com</p>
  
  <p>Step 3, I create my new website I called domain2.com too</p>
  
  <p>Step 4, I create my new store I called DOMAIN2 which I made the default store for the website created in step 3. The root category for this store is the one created in step 2.</p>
  
  <p>Step 5, I create a couple of store view for the languages, all are enabled.</p>
  
  <p>Step 6, in System -> Configuration -> Web tab, after selecting my newly created website in the Current Configuration Scope section, I change the secure and unsecure Base URL for <a href="https://store.domain2.com" rel="nofollow">https://store.domain2.com</a> and <a href="http://store.domain2.com" rel="nofollow">http://store.domain2.com</a></p>
  
  <p>Step 7, in the .htaccess file located in the domain1/magento folder, I add those lines at the end of the file:
      SetEnvIf Host domain1.com MAGE_RUN_CODE=base
      SetEnvIf Host domain1.com MAGE_RUN_TYPE=website
      SetEnvIf Host ^domain1.com MAGE_RUN_CODE=base
      SetEnvIf Host ^domain1.com MAGE_RUN_TYPE=website</p>
  
  <pre><code>SetEnvIf Host store\.domain2\.com MAGE_RUN_CODE=domain2
  SetEnvIf Host store\.domain2\.com MAGE_RUN_TYPE=website
  SetEnvIf Host ^store\.domain2\.com MAGE_RUN_CODE=domain2
  SetEnvIf Host ^store\.domain2.com MAGE_RUN_TYPE=website
  </code></pre>
  
  <p>CODE=base is because I left the default value for my first store
  CODE=domain2 is because that is the code name I gave to the domain2.com website (in magento)</p>
  
  <p>Now the problem is when I go to store.domain2.com, the store of domain1.com appear and I can’t figure out how to make my second store appear instead.</p>
  
  <p>Plus, I set the domain2.com as default just to see the result and both my sites are displaying a magento frame with no content, even if I created categories for my second store.</p>
  
  <p>Anyone can help me on this one?</p>
  
  <p>Thanks </p>