site.com = frontend.php
www.site.com = frontend.php
dev.www.site.com = frontend_dev.php
backend.site.com = backend.php
dev.backend.site.com = backend_dev.php
Изменяем index.php
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
// get the domain parts as an array
@list($tld, $domain, $subdomain, $subdomain2) = array_reverse(explode('.', $_SERVER['HTTP_HOST']));
// determine which subdomain we're looking at
$app = ($subdomain == 'webadmin') ? 'backend' : $subdomain;
$app = (empty($app) || $app == 'www' ) ? 'frontend' : $app;
$env = (empty($subdomain2) || $subdomain2 == 'www') ? 'prod' : $subdomain2;
// determine which app to load based on subdomain
if (!is_dir(realpath(dirname(__FILE__).'/..').'/apps/'.$app))
{
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
}
else
{
$configuration = ProjectConfiguration::getApplicationConfiguration($app, $env, false);
}
sfContext::createInstance($configuration)->dispatch();
Использованные материалы: Dynamically Loading Symfony Applications Via Subdomains