You might have thought about it - me too :) It’s one simple way to use subdomains to manage the chosen application of your symfony project.

<?php

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');

switch ($_SERVER['HTTP_HOST'])
{
  case 'backend.megacomplex.de':
    $configuration = ProjectConfiguration::getApplicationConfiguration(
      'backend',
      'prod',
      false);
  break;

  case 'mkt.megacomplex.de':
    $configuration = ProjectConfiguration::getApplicationConfiguration(
      'mkt',
      'prod',
      false);
  break;

  case 'nopaste.megacomplex.de':
    $configuration = ProjectConfiguration::getApplicationConfiguration(
      'nopaste',
      'prod',
      false);
  break;

  default:
    $configuration = ProjectConfiguration::getApplicationConfiguration(
      'game',
      'prod',
      false);
  break;
}

sfContext::createInstance($configuration)->dispatch();

That’s the index.php I’m using for Megacomplex. On the other hand you will have to setup your webserver correctly!

blog comments powered by Disqus
Blog Logo

Toni Uebernickel

Software Engineer and Architect, Symfony and Propel evangelist with some Ducati bikes.

Image

havvg's playground

Developing Software is Fun!

View the index page.