Magento Network Controller

Can I send websites programmatically to Magento? Currently, I have a directory at the root of my site called / websites. In this directory, I have subdirectories for each website, for example site_a, site_b, site_c. Then in each subdirectory of the site there is .htaccess and index.php with the corresponding startup code, for example:

$mageFilename = '../../app/Mage.php';
require_once $mageFilename;    
Mage::run("site_b", "website");

at index.php at / websites / site _b. Although this works, I want to avoid managing files on the file system. Can anyone give any recommendation on the best way to do this? Perhaps a script in / websites that stands in place of the individual subdirectories of the site. Any help was appreciated.

+3
source share
3 answers

$_SERVER php, Mage:: run ( "whatever", "website" ); , :

$whatever=$_SERVER['condition/url/whatever'];

// or use some cookies 

if (isset($_COOKIE['dev'])) $whatever=$_COOKIE['dev'];


switch($whatever)
{ case "example.com":
  case "www.example.com":
    $_SERVER['MAGE_RUN_CODE'] = "example";
    $_SERVER['MAGE_RUN_TYPE'] = "website";
    break;
  case "dev":
  case "test.com":
    $_SERVER['MAGE_RUN_CODE'] = "test";
    $_SERVER['MAGE_RUN_TYPE'] = "website";
  default:
    $_SERVER['MAGE_RUN_CODE'] = "live";
    $_SERVER['MAGE_RUN_TYPE'] = "website";
}
Mage::run($_SERVER['MAGE_RUN_CODE'], $_SERVER['MAGE_RUN_TYPE']);

Magento .

+3

.htaccess :

#SetEnvIf Host www\.lenjerii\.com MAGE_RUN_CODE=base
#SetEnvIf Host www\.lenjerii\.com MAGE_RUN_TYPE=website
#SetEnvIf Host ^lenjerii\.com MAGE_RUN_CODE=base
#SetEnvIf Host ^lenjerii\.com MAGE_RUN_TYPE=website

#SetEnvIf Host www\.wildfashion\.ro MAGE_RUN_CODE=wildfashion
#SetEnvIf Host www\.wildfashion\.ro MAGE_RUN_TYPE=website
#SetEnvIf Host ^wildfashion\.ro MAGE_RUN_CODE=wildfashion
#SetEnvIf Host ^wildfashion\.ro MAGE_RUN_TYPE=website

-.

0

If I understand you correctly, you need some kind of symbolic link: in each subdirectory, make a symbolic link to the original installation. The IE: ln -s ../app/ ./app.
Check out this tutorial.

-1
source

All Articles