Skip to content

Instantly share code, notes, and snippets.

@bdunogier
Created March 16, 2012 11:07
Show Gist options
  • Save bdunogier/2049622 to your computer and use it in GitHub Desktop.
Save bdunogier/2049622 to your computer and use it in GitHub Desktop.
<?php
/**
* PHP version of the rewrite rules that were previously used to enable multi-site in a cluster environnement
*
* Each site has its own file, based on its vardir subcomponent: var/plain_site/ => config.cluster/plain_site.php.
* The cluster rewrite rules send everything to index_cluster.php, for every site.
**/
if ( !$siteId = preg_match( "|^/var/([^/]+)/|", $_SERVER['SCRIPT_URL'], $m ) )
// error 404
// exit
$configFile = "config.cluster/$siteId.php";
if ( !file_exists( $configFile ) )
// error 404
// exit
include $configFile;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment