WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Bad url for sub-directory site (14 posts)

  1. dkallaire
    Member
    Posted 3 years ago #

    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?

  2. 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.

  3. dkallaire
    Member
    Posted 3 years ago #

    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.

  4. dkallaire
    Member
    Posted 3 years ago #

    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.

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

  6. dkallaire
    Member
    Posted 3 years ago #

    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.

  7. 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.

  8. dkallaire
    Member
    Posted 3 years ago #

    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.

  9. $base = DB_NAME;

    remove this one.

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

  10. dkallaire
    Member
    Posted 3 years ago #

    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.

  11. 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!)

  12. dkallaire
    Member
    Posted 3 years ago #

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

    :) (for now)

  13. 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..."

    :D

  14. dkallaire
    Member
    Posted 3 years ago #

    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. :o

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

Topic Closed

This topic has been closed to new replies.

About this Topic