Created
November 15, 2017 15:34
-
-
Save froboy/c35732abe4cd1f41729f92d8557762ef to your computer and use it in GitHub Desktop.
If you have a Drupal multisite with predictable hostnames, use this to keep your sites.php lean.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sites['somecustomsitename.com'] = 'somecustomsite.com'; | |
if (strpos($_SERVER['HTTP_HOST'], "-ra") != FALSE) // somesite-ra.com | |
{ | |
$sites[$_SERVER['HTTP_HOST']] = // Cut out -ra and rewrite to somesite.com | |
str_replace("-ra", "", $_SERVER['HTTP_HOST']); | |
} | |
if (strpos($_SERVER['HTTP_HOST'], "-dev") != FALSE) // somesite-dev.com | |
{ | |
$sites[$_SERVER['HTTP_HOST']] = // Cut out -sites and rewrite to somesite.com | |
str_replace("-dev", "", $_SERVER['HTTP_HOST']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment