4

I need to create create another store, I am following the instructions on the Wiki magento but I can not work.

my problem is that when you enter the second store redirects me to the main store

eg. subdomain.mydomain.com when I enter redirects me to mydomain.com

I also tried to create folder using just the second store, the url is displayed like mydomain.com/store2

but it shows me the home page of my main store

Files:

index.php

Last lines

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'knksvip';

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

Mage::run($mageRunCode, $mageRunType);

.htaccess

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

in store view Base URL Changed to

http://subdomain.mydomain.com/

4
  • Try to clean your cache
    – Zsolti
    Feb 13, 2015 at 10:58
  • 1
    I'd be surprised if it were a cache issue. Its worth checking your domain alias settings, as sometimes they can be set to act as a 301 to the main domain.
    – thebluefox
    Feb 13, 2015 at 11:26
  • 1
    before requesting help to you I checked the cache and is not the problem. Feb 13, 2015 at 11:59
  • base url at least is correct?
    – user2857
    Feb 14, 2015 at 21:40

2 Answers 2

3

I have no clue how the mod_rewrite settings is working, but for us always worked:

SetEnvIf Host www\.domain2\.com MAGE_RUN_CODE=storecode1
SetEnvIf Host www\.domain\.com MAGE_RUN_CODE=storecode2
4
  • I am asking some info apart from your post, i am created multi-store, using blog.chapagain.com.np/magento-setup-multiple-website. I am using the same theme for both stores, how can i change header and footer for my second store, pls keep in mind same theme. What is the use of symlinks?
    – zus
    Dec 25, 2017 at 12:06
  • Add a CMS block into both themes and have two different blocks added. Dec 26, 2017 at 11:23
  • In localhost, what is your suggestion?
    – zus
    Feb 22, 2018 at 7:32
  • Add domains to your hosts file en.wikipedia.org/wiki/Hosts_(file) and use local domains. Or directly use the TLD .localhost like: de.customer.localhost, en.customer.localhost (I'm not sure a subdomain works out of the box, so maybe you have to use en-customer.localhost) Feb 22, 2018 at 9:53
0
/* Run store or run website */ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'website';

 if ($_SERVER['HTTP_HOST']=="subdomain.mydomain.com") $mageRunCode="knksvip"; // <-- new line here

 Mage::run($mageRunCode, $mageRunType);

Chances are your .htaccess isn't passing the value. This new line in your index.php will set your run code.

14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.