Site frontpage doesn't work for multiple domains
nedjo - May 15, 2007 - 17:54
| Project: | Multiple Domains |
| Version: | 5.x-1.x-dev |
| Component: | code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | nedjo |
| Status: | closed |
Jump to:
Description
Problem:
When we set a front page for a specific domain, it has no effect.
Cause:
The problem is that the home page is set in drupal_init_path() before hook_init(), where we reset the variables.
Solution:
In multidomain_init(), test if we are on the front page and, if so, reinitialize the path after we reset variables.
Patch attached.
| Attachment | Size |
|---|---|
| multidomain-front.patch | 1.07 KB |

#1
This works but for some reason removes the menu link under the admin/by-module page (admin/settings/multidomain). Patch app doesnt work for me, so I just copied it in manually. SOLVES THE FRONT PAGE ISSUE, THANKS!
function multidomain_init() {
global $conf;
$domains = variable_get('multidomain_sites', array());
$protocol = ( $_SERVER['HTTPS'] ) ? 'https://' : 'http://' ;
if ($domain = $domains[$protocol . $_SERVER['HTTP_HOST']]) {
// Determine if we are currently on the home page.
$front = drupal_is_front_page();
// Set any variables specific to this domain.
if(isset($domain['variables']) && is_array($domain['variables'])) {
foreach($domain['variables'] as $name => $value) {
$conf[$name] = $value;
}
}
if ($domain['init']) {
drupal_eval($domain['init']);
}
// If we are on the home page, reinitiate the $_GET['q'] value.
if ($front) {
unset($_GET['q']);
drupal_init_path();
}
}
}
#2
Applied.
#3