Hi All
After a few days of trying to get a multisite install configured, I finally made it but another problem surfaced.
The two other sites I created all seem to work fine after they installed, except that whenever I click on the administer link in the navigation block, they both navigate to the default drupal site therefore I get logged out / wind up administering / editing /configuring the wrong website.
How I have it set up is three different sites "drupal/sites/default" <===the default site folder created by drupal comes up by typing http://localhost , "drupal/sites/site1" and "drupal/sites/site2". Whenever I click administer in either site1 or site2 instead of going to http://localhost/site2/admin or http://localhost/site1/admin it would go to http://localhost/admin.
How do I correct this problem with the "administer" links on the two other sites I added linking back to the default drupal install folder?
Please help.
Regards
Adrian
Comments
Different Multi-sites linking to default drupal site admin link
Got the problem resolved a few days ago.
Set the default url
Was your solution to set the base URL in the settings.php file for each sub-site? Because that is what I use.. I also had to write validation functions to accurately detect the sub-site base path as Drupal will only give you the Drupal base path, not the sub-site base path.
Really annoying for themeing and custom module development. Here is my code for anyone with the same problem.
/**
* Utility Functions
* Set of utility functions used for all requests
*/
/* returns the root URL of the system */
function phptemplate_get_root_url() {
$root = 'http://';
if ($_SERVER['SERVER_PORT'] != 80) {
$root = 'https://';
}
$site_root = rtrim($_SERVER['SERVER_NAME'], '/');
$path = $root.$site_root;
preg_match('(^/([^/]+))', $_SERVER['REQUEST_URI'], $uri_matches);
$doc_root = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
if(isset($uri_matches[1])){
$sub_site_path = $doc_root.'/sites/'.$site_root.'.'.str_replace('/', '', $uri_matches[1]);
if(is_dir($sub_site_path)) {
$path = $root.$site_root.'/'.str_replace('/', '', $uri_matches[1]);
}
}
return $path;
}
Robert Foley Jr
Solutions Architect
http://www.robertfoleyjr.com