• 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

Viewing 12 replies - 1 through 12 (of 12 total)
  • or is $base supposed to hold the base path, but that it has wrongly been changed somewhere else in the code (cascading bug)?

    Yep. Go look in your .htaccess file, as that is where it pulls the $base value from.

    Thread Starter jo_inge_arnes

    (@jo_inge_arnes)

    Ok. So it’s probably a configuration issue. This is what the .htaccess looks like:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]

    Since there wasn’t any .htaccess-file in the directory, I created a new file and copy/pasted the text into the .htaccess-file from the WordPress-message telling me to do so.

    Something is probably missing in the file?

    Thread Starter jo_inge_arnes

    (@jo_inge_arnes)

    I found it! It’s the wp-config.php. I figured out that you meant wp-config.php, not .htaccess.

    First it says:

    $base = '/';

    But then it says:

    /* Stop editing */
    
    $server = DB_HOST;
    $loginsql = DB_USER;
    $passsql = DB_PASSWORD;
    $base = DB_NAME;

    Notice the last line. It sets $base to DB_NAME.

    Whups, thanks for the catch on the filename. ??

    huh, How did that base get in there?

    Either fantastico or Dreamhost is adding those lines. See original code here:

    https://core.trac.www.ads-software.com/browser/trunk/wp-config-sample.php

    Thread Starter jo_inge_arnes

    (@jo_inge_arnes)

    huh, How did that base get in there?

    I have no idea! ??

    I’m testing WordPress 3.0 multisite on a Dreamhost PS (private server), because I’ve been asked to take over and redesign a site from scratch. I used the One-Click Install to install WordPress. I then made it multisite, as described on the WordPress-site. I added define ('WPLANG', 'nb_NO'); before I logged in. When I logged in, I could use the “automatic upgrade” feature to get the norwegian version of WP 3.0.

    But, I think that the last part after /* Stop editing */ was already there when I first looked at the file. I noticed it, because it didn’t say exactly the same as the WordPress documentation said. It’s supposed to say: /* That's all, stop editing! Happy blogging. */:

    Could it be that Dreamhost’s One Click Install is using a custom file, where they for some reason have added the last lines (with $base = DB_NAME)?

    Hmmm…

    Thread Starter jo_inge_arnes

    (@jo_inge_arnes)

    andrea_r: Ok. Thanks. I see that you answered my question before I got time to post my last comment. I’ll try to remove the last line and see what happens. My guess is that the lines were added by Dreamhost’s automatic installer, as you said.

    MU came with its own htaccess.dist which it used to build the htaccess file for you. It originally had the base variable in it.

    See? https://trac.mu.www.ads-software.com/browser/trunk/htaccess.dist

    Having this same issue with my Dreamhost account.

    If you ask Dreamhost or read their docs, they do not support MU or multisite on their shared plans, only their VPS.

    But deleting those lines:

    $server = DB_HOST;
    $loginsql = DB_USER;
    $passsql = DB_PASSWORD;
    $base = DB_NAME;

    Seems to fix it. ??

    Yes, those are added by thier One Click installer. It’s really only the $base line that interferes, as WP uses the same variable.

    Same issue here. I changed the last line above to:// $base = DB_NAME;
    and it seems to have fixed it for me as well.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Database name added to new site URL’ is closed to new replies.