WordPress.org

Ready to get started?Download WordPress

Forums

Domain alias for Main Site in Multi-site (9 posts)

  1. everwill
    Member
    Posted 3 years ago #

    I've come to believe that I with my current configuration (a Plesk panel Linux box) I cannot have domain aliases for my main site in a WP multi-site install. I didn't know this before I set-up so I have a main site that needs several aliases. For a time, I just mirrored the site to subdomains that acted as aliases but that is way too cumbersome to maintain. In addition what I really want are domain aliases.

    So my question is, can I really just use the Network panel to pick a different primary site and then have at it? If so, that would be super awesome.

  2. Tim Moore
    Moderator
    Posted 3 years ago #

  3. everwill
    Member
    Posted 3 years ago #

    Thanks for the tip.

    Can you tell me if there are any pitfalls for changing my primary domain?

  4. None of the domain mapping plugins will work on the main site in a network.

    The reason for this is because it changes the base domain that all blogs are created from.

    @everwill - if you need to change the domain of the main site (and thus everything) you're looking at a search & replace in the entire database.

  5. everwill
    Member
    Posted 3 years ago #

    There is a panel/page called "My Sites". On that page there is a selector for the "primary site". What happens if I select one of the other sites as the main site?

  6. Nothing.

    That is for *your* primary site - the one your user account is attached to, and the one you will be redirected to when logging in.

    the main domain you started with is still the main domain of the network. there is no way to change that other than manually. (ie; a lot of work)

  7. everwill
    Member
    Posted 3 years ago #

    Grrrrr ... I suppose I have no one to blame but me. However, I wish I'd known about that before I got going. I'm not sure why it's a good idea to disallow domain aliases for the primary site.

  8. I'm not sure why it's a good idea to disallow domain aliases for the primary site.

    Recursive DNS checks and endless loops. If you do it right, yeah, it's fine. If you screw it up, which is SO easy, you kill yourself.

  9. bradbrown
    Member
    Posted 3 years ago #

    I wanted to use both a mobile and desktop domain for my main site of a multisite network. (www.bradbrownmagic.com accesses the desktop version, and m.bradbrownmagic.com accesses the mobile version.) After some trial and error, I came up with something that seems to work for my needs.

    I'm using an up to date WordPress install: WP 3.1.2, MU Domain Mapping 0.5.4, and WP Mobile Pack 1.2.4.

    Here's what I did:

    Under Network Admin > Settings > Domain Mapping, check the box for "Disable primary domain check."

    Under Network Admin > Settings > Domains, create the alias. It won't let you create an alias for the main site, so create it for anything else. I used 7 for the site ID, as that was not being used. I also had "primary" unchecked, though I don't know that it matters since primary domains are disabled anyway.

    I had to manually edit the database to point my new alias to the main site. Using phpMyAdmin, I edited the wp_domain_mapping table. I updated the record for my alias and changed the blog_id to 1, for the main site.

    Under Site Admin (for my main domain) > Appearance > Mobile Switcher, I set it up to use my mobile and desktop domains.

    That's it. Since I had to turn off the primary domain functionality for the entire network, I also updated my .htaccess to do a rewrite for the non canonical domains in the network to prevent the possibility of duplicate content issues.

    Obviously, this is a hack, so if you decide to give it a try, back everything up and proceed at your own risk!

    -Brad

Topic Closed

This topic has been closed to new replies.

About this Topic