2

I followed the steps on this tutorial to setup my multi-domain site, and its working fine, but now i want to setup my another site which has multi sites but currently I have single i.p address to access them all. I tried different tricks in httpd.conf, .htaccess and also changed site address in admin panel at site level but it did not work. How I can make them working with single ip address?

Any help would be highly appreciated.

My httpd.conf file

<VirtualHost *:80>
    DocumentRoot /var/www/
    ServerName 1.2.3.4
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /var/www/
    ServerName 1.2.3.4/a
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /var/www/
    ServerName 1.2.3.4/b
</VirtualHost>

My .htaccess file

 SetEnvIf Host 1.2.3.4 MAGE_RUN_CODE=base
 SetEnvIf Host 1.2.3.4 MAGE_RUN_TYPE=website
 SetEnvIf Host ^1.2.3.4 MAGE_RUN_CODE=base
 SetEnvIf Host ^1.2.3.4 MAGE_RUN_TYPE=website

 SetEnvIf Host 1.2.3.4/a MAGE_RUN_CODE=site_a
 SetEnvIf Host 1.2.3.4 MAGE_RUN_TYPE=website
 SetEnvIf Host ^1.2.3.4 MAGE_RUN_CODE=site_a
 SetEnvIf Host ^1.2.3.4 MAGE_RUN_TYPE=website

 SetEnvIf Host 1.2.3.4/b MAGE_RUN_CODE=site_b
 SetEnvIf Host 1.2.3.4/b MAGE_RUN_TYPE=website
 SetEnvIf Host ^1.2.3.4/b MAGE_RUN_CODE=site_b
 SetEnvIf Host ^1.2.3.4/b MAGE_RUN_TYPE=website

I tried ips like 1\.2\.3\.4 in .htaccess as well.

I also changed the site unsecure/secure urls to 1.2.3.4/a and 1.2.3.4/b but no gain.

1 Answer 1

1

If I understand your question correctly then you can handle the redirect in index.php for a single IP. However you will need to consider the SSL implications for just having a single IP. One option is to get a SANs SSL...

if ($_SERVER['HTTP_HOST'] == "www.website1.com"){
    $_SERVER["MAGE_RUN_CODE"] = "website1code";
    $_SERVER["MAGE_RUN_TYPE"] = "website";
}

if ($_SERVER['HTTP_HOST'] == "www.website2.eu"){
    $_SERVER["MAGE_RUN_CODE"] = "website2code";
    $_SERVER["MAGE_RUN_TYPE"] = "website";
}


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

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

Mage::run($mageRunCode, $mageRunType);
1
  • I do have only i.p for now, do not have any domain name mapped on that i.p. would it work the same way for the i.p? Commented Aug 5, 2013 at 1:18

Your Answer

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

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