WordPress.org

Support

Support » Multisite » [Resolved] Bad url for sub-directory site

[Resolved] Bad url for sub-directory site

  • This is on DreamHost shared server and that -might- be the problem.

    After successfully installed a sub-directory network I added a user and a site. I can see the user in network admin and he can try to login. It recognizes his user name and password but the url it tries to go to is bad.

    It looks for jsa2011.comjsa2011_com_1user, which is how it appears in the user’s line in the database table. The db is named jsa2011_com_1.

    The .htaccess file, copied from the Network Install page:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    The relevant lines in wp-config.php, copied from the Network Install page:

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'jsa2011.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    Any ideas?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Don’t wrap EACH line in code tags next time, please 🙂 Just one at the beginning of the block and one at the end.

    Wait, you named the DB jsa2011_com_1? Not jsa2001_com_? That 1 may be the issue.

    Thanks for the tip.

    The install program did the naming (yes I gave in to the lure of one-click).

    I should change the name in the DH dashboard and in wp-config?
    Does it need a trailing _?

    Thanks for your patience, Ipstenu.

    Changing the db name doesn’t do it.

    I got rid of the subdirectory name and site and created new ones. The url is still the same form: domain.comdbnameusername.

    Search your wp-config.php file for a BASE call that has your DB name in it.

    All I find is `$base = ‘/’;’ in the lines copied from the network install page.

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'jsa2011.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    The database lines show define the name, user, password, and host.

    Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    Down at the bottom of the config file – DH’s one click installer adds another base line with your db name in it and this messes up URLs.

    How helpful of them. Here’s what I have there:

    /* Stop editing */
    
    $server = DB_HOST;
    $loginsql = DB_USER;
    $passsql = DB_PASSWORD;
    $base = DB_NAME;
    
    define('ABSPATH', dirname(__FILE__).'/');
    
    // Get everything else
    require_once(ABSPATH.'wp-settings.php');

    Should those four $ lines be removed? WP defines the same information at the beginning of the file.

    Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    $base = DB_NAME;

    remove this one.

    It won;t fix the already created sites, but new ones will work. delete the broken ones.

    Amazing. That did it.

    Also amazing that I didn’t notice that line because it was below Stop editing even though Ipstenu told me to look for it. Yesterday was very long.

    I’m going to brush up on my unix and try to make php less a matter of guesswork.

    Thanks, both of you.

    No prob 🙂 And this is how we all learn (normally I remember to say ‘There may be duplicates’ but, as you said, long days. My house is a box!)

    The “fun” of coding and web admin: This ought to be easy. Nothing works! Nothing works! Nothing works! Wow, that was easy.

    🙂 (for now)

    Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    Wait’ll you get to level 2: “OMG WHY ISN’T THIS WORKING??? It did the last 10000 times I did it!. *finds typo*. Nevermind…”

    😀

    What’s fun to do with html is upload to the wrong directory over and over (and over) and wonder why the page doesn’t change. That’s happened. php and MySQL open up whole new opportunities for me. 😮

    Thanks again. I hope it’s a little longer before my next plea for help.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Bad url for sub-directory site’ is closed to new replies.
Skip to toolbar