Database name added to new site URL
-
I have a fresh WordPress 3.0 multisite installation. When a new site (blog) is created, it’s path is set to the database name. As a result the URLs for the site (the domain name + base path) will end up containing the database name, instead of a slash.
I have located the PHP-file causing the error. In the file ms-edit.php I found this code:
if ( is_subdomain_install() ) { $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); $path = $base; } else { $newdomain = $current_site->domain; $path = $base . $domain . '/'; }
I changed this part:
$path = $base;
to
$path = '/';
This hack solved the problem. The path was no longer set to the database name, but to a slash, when a new site was created. And the URLs for this new site worked fine.
The problem, as you can see from the code, is that the variable $base contains the database name, not the base path.
My question is: Why? Is this a bug where the wrong variable has been used, or is $base supposed to hold the base path, but that it has wrongly been changed somewhere else in the code (cascading bug)? Or is it caused by a configuration issue?
PS: I’m using a norwegian version of WordPress 3.0
- The topic ‘Database name added to new site URL’ is closed to new replies.