[resolved] Network subdomain wrangling (10 posts)

  1. mjones22
    Posted 4 years ago #

    Hi WP Forums-

    I am using WordPress Multisite to give clubs and student organizations their own blogs at my high school.

    Here's my current setup:

    example.com - high school's main website, completely separate CMS
    chess.example.com - potential website for the chess club, one of many networked WordPress sites
    news.example.com - high school's news website
    ... etc.

    Since WordPress isn't hosted on the example.com subdomain (but I do have wildcard DNS pointing to my server), is there any way that multisite can create blogs at name.example.com? As of now (with blog.example.com as the initial site I made), blogs are created at name.blog.example.com.


  2. You could try treating them as mapped domains instead of subdomains, but ... where is WP installed? If it's in a subfolder, like example.com/wordpress, then you'd get chess.example.com/wordpress

    If you put it in wordpress.example.com, though, with subfolders for /chess etc, then you could MAP chess.example.com to wordpress.example.com/chess

    I think.

  3. mjones22
    Posted 4 years ago #

    WordPress is installed in the root.

    Subfolders would potentially work, but it's less of an elegant solution IMO.

    From wp-config.php:

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

    The problem occurs when I change blog.example.com to example.com - creating new blogs 302 redirects to example.com - which is using a completely separate CMS.

  4. mjones22
    Posted 4 years ago #

    Problem solved.

    define('NOBLOGREDIRECT', 'http://blog.example.com/wp-signup.php');
    define('DOMAIN_CURRENT_SITE', 'example.com');

    For the uninitiated, NOBLOGREDIRECT is very useful. By default, it redirects you to http://DOMAIN_CURRENT_SITE/wp-signup.php if you go to a nonexistent blog, so if you want people to sign up elsewhere you just have to add a define.

    This could also be useful to redirect people back to example.com if you've got wildcard DNS and don't want everyone making blogs.

    EDIT: Not completely resolved!
    404s redirect to the NOBLOGREDIRECT path. Put this code into wp-content/plugins/404.php:

    remove_action( 'template_redirect', 'maybe_redirect_404' );

    DOUBLE EDIT: This actually doesn't work. Trying to find a better/less hacky solution.

  5. Wait, WordPress is installed in the ROOT of example.com? Then just make subdomains and call it a day.

    You said

    example.com - high school's main website, completely separate CMS

    So I ASSUMED that you didn't have WordPress in root.

    WHERE is WP installed? :)

  6. mjones22
    Posted 4 years ago #

    WP is installed on a completely separate server than the main high school CMS. It receives all traffic from wildcard subdomains. That's why I commented that people would be inadvertently getting their blogs set up at name.blog.example.com instead of example.com.

    It is in the root of the WILDCARD subdomain, not the example.com subdomain.

  7. Okay.

    Let's make it simplier for dumb brains here. ;)

    1) You have something installed at example.com

    2) WordPress is installed at wp-example.com

    3) You want chess.wp-example.com to point to chess.example.com right?

    So yeah, just go ahead and do that, and then MAP chess.example.com to chess.wp-example.com

  8. mjones22
    Posted 4 years ago #


    WordPress is installed at blog.example.com and I want it to make blogs at name.example.com. There's something else entirely on example.com, correct.

  9. Okay. Then as I said the first time.

    Make your blogs blog.example.com/chess and MAP them to chess.example.com

    That will have them appear as chess.example.com to anyone visiting.

  10. mjones22
    Posted 4 years ago #

    Thanks, that's a great suggestion.

Topic Closed

This topic has been closed to new replies.

About this Topic