• Hi. I have a wordpress install on a domain: https://www.example.com on a dedicated server. For testing purpouses I also have a domain, beta.example.com on a different server.

    On the beta server I’d like to install multipress wordpress. One install in the root, and one subsite in a subfolder (beta.domain.com & beta.domain.com/subblog1 & beta.domain.com/subblog2).

    The installation seems to work fine, edited wp-config (with subdomain_install set to false), .htaccess., created blogs.dir.

    It seems to work at first, but that I notice that the media files are being downloaded from example.com instead of beta.example.com. Also, allthough the startpage is beta.example.com all the links direct to example.com. When I try to login it automaticly redirects to example.com/wp-admin (which is on a different server). Also with coockies and cache turned off.

    I looked for an answer for ages. At first I thought It might be the .htaccess, but that wouldn’t explain that the links direct to the main server.

    This is the extra code in the wp-config:

    define('WP_HOME', 'https://beta.domain.com');
    define('WP_SITEURL', 'https://beta.domain.com');
    
    /* Multisite enabled */
    define( 'MULTISITE', false );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'beta.domain.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    
    define( 'NOBLOGREDIRECT', '' );
    $cookie_domain = 'beta.domain.com';

    Does anyone have any thoughts?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You installed WP in the beta folder, right?

    And all the URLs say beta.domain.com in the database?

    Thread Starter André Boekhorst

    (@andrex84)

    I installed it on a totally different server (it’s a bit confusing indeed). All the links are relative, so it all works when I disable multisite:

    define( 'MULTISITE', false );

    If I set it to true, all the links direct to domain.com/ instead of beta.domain.com. Also all the media files (css and images) are downloaded from domain.com.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Nah, not confusing ?? That’s how badass subdomains work ??

    Are all the links pointing to domain.com in the source?

    Thread Starter André Boekhorst

    (@andrex84)

    All the links, including Images and CSS, point to the main domain, and the links are not in the database.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    In the SOURCE code though? I mean you hit view-source and looked, right?

    Because it is possible you’re seeing a DNS redirect.

    Thread Starter André Boekhorst

    (@andrex84)

    Oh yes, they point to it in the source, as in
    <a href="https://www.domain.com">link</a>

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Now that’s interesting.

    It’s just the images and CSS of the theme, right? Not the ones in the posts?

    Thread Starter André Boekhorst

    (@andrex84)

    It’s not just the images and CSS. The website runs on the beta server, and if you go to any page you will see it on the beta domain. Therefore, all the relative links will work. But all the links that are generated through wordpress (eg. in the main menu) will automatically direct to the main domain, also those of the CSS, JS and Images.

    To me it doesn’t look like a bug, but more a setting that I’ve missed. I can imagine WordPress taking over the domain, since it may want to use those subdomains. But I can’t find the switch to turn it off…

    I found a reference: https://tech.velmont.net/howto-use-subdomain-wordpress-multisite-3-x-3-0-and-3-1-without-dashboard-site/ He added:

    define( 'NOBLOGREDIRECT', 'https://example.com' );
    $cookie_domain = '.example.com';

    in the wp-config, but that didn’t help me. And I can’t set any domain mapping plugins since I don’t have access to the Admin.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    All no-blog-redirect does is … tell you where to go if someone visits a non-extant site. It’s more useful on subdomain installs, where you can redirect foobar.example.com to example.com/hahhahhahnosoupforyou or whatever you want.

    But all the links that are generated through wordpress (eg. in the main menu) will automatically direct to the main domain, also those of the CSS, JS and Images.

    See that’s what’s bizarre. Somewhere you had to have told WordPress about that main domain (i.e. domain.com, NOT beta.domain.com). Otherwise WP would have no knowledge of it.

    And strictly speaking, your MAIN domain is beta.domain.com, for the purposes of that install.

    Thread Starter André Boekhorst

    (@andrex84)

    I’m sorry I didn’t find a solution. I abandoned the idea of using a multipress site.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Subdomain maps to main domain.’ is closed to new replies.