Support » Networking WordPress » Can I have a very specific URL structure in multisite

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

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Not really.

    Using different domain names requires WP to be installed in the root (i.e. drupalsite.com, not /blog). This is an Apache/Webserver issue, sadly.

    Thread Starter captainpants

    (@captainpants)

    Surprisingly I did actually find a work around using a sub directory but I ran into another problem. After importing all my posts, categories, tags etc… into my new site, I noticed that all of their links redirect me to the home page of the primary site…

    if local.drupalsite.com/blog was the primary site, clicking on
    http://local.drupalsite.co.uk/blog/category/how-to/
    would redirect to local.drupalsite.com/blog

    My workaround using a sub directory is as follows…

    1. Replacing code in wp-config.php using these lines

      $base = '/';
      define( 'DOMAIN_CURRENT_SITE', 'www.drupalsite.com' );
      define( 'PATH_CURRENT_SITE', '/blog/' );
    2. Under the info tab when editing an individual site, forcing the domain to be any domain you want… IE http://www.drupalsite.co.uk, and in the same tab, making the path /blog/
    3. Under the settings tab when editing an individual site, forcing the site url to be http://local.drupalsite.co.uk/blog/
      and forcing the home field to be http://local.drupalsite.co.uk/blog/

    I have a feeling this isn’t a good way to go about things…

    Thread Starter captainpants

    (@captainpants)

    Well apparently my boss is a genius because he fixed the problem with one simple line of code

    define( 'DOMAIN_CURRENT_SITE', $_SERVER['SERVER_NAME'] );

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Huh, I can see that working.

    Though I can see it problematic with some plugins that don’t anticipate that… I really hope WP comes up with a solution. I have this niggling memory about why we don’t use Server name like that…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can I have a very specific URL structure in multisite’ is closed to new replies.