Bedrock multisite with different domains + local dev procedure & deploy

I was wondering if anyone tried creating a Bedrock multisite install using separate domains and is that even a good idea? (No Trellis involved - unless you think I absolutely should use it and it’s way easier with it)

And if it’s not, why not?

(Haven’t properly tried it, except following the basic subdomain procedure, which seems to work even on Valet / nginx - server will be Apache on production)

For example:

mydomain.org (main domain)
mydomain.es (this would -in subdomain installation- be, say es.mydomain.org)
something.fr (this would -in subdomain installation- be, say fr.mydomain.org)
somethingelse.it (this would -in subdomain installation- be, say it.mydomain.org)
etc.

More or less all pages have similar content (especially frontpage) except in their own language.
Some posts and subpages are different + minor tweaks here and there. I guess rel=canonical would have to be applied here properly? (can WPML handle this multisite business with multiple domains anyway?)

This article describes a basic subfolder or subdomain install which I followed:

Unfortunately WPML domain mapping which might have helped, is deprecated (stopped support/development).

Any help / tips appreciated.

Hey @trainoasis, yes I’ve done this exact setup a couple of times, even launching a new one this week in fact. The good news is that it works perfectly with no plugins.

The domain mapping is built into core Wordpress now, that’s why WPML domain mapping is deprecated.

https://wordpress.org/support/article/wordpress-multisite-domain-mapping/

What I always do, is get it all working with subdomains, and then like that page there says, just go in the network admin and change your site url from es.mydomain.org to mydomain.es and it just works.

Obviously on the dns and server side the domain has to be be pointing to your multisite server and the web server must be listening for it and also point it to the multistie install. Same process as adding those subdomains.

Thanks @Andrew_Scofield I did not realize that! This is great, it does seem to work out of the box!

Did you use this approach for local development as well?
Do you perhaps use Laravel’s Valet for local server?

A few things I noticed:

  1. When entering custom TLD inside Site Address (URL) it changes https back to http when saving. Why would that be? That doesn’t happen to you I reckon?
  2. When adding another site to Valet via valet link newsite-tld.myit by default won’t be secure (without https). When trying to secure it via valet secure it secures the first site, which is already using https.
  3. There shouldn’t be any issues having separate email accounts for all these TLD’s right? Everything stays the same on the Cpanel side, domains added as Addon domains.
  4. If emails for each domain were not required, you could theoretically just use DNS A record and that’s that, right?
  5. How did you manage development/staging/production environments in general? It’s a bit more complex in comparison to just having a single basic install. For example, we already have about 13 separate domains online and live. Now I’d rewrite them to use the same theme withing multisite install and to use Bedrock + Sage. I’m thinking someone will mention Trellis here…? :slight_smile:

Thanks for sharing the info about wordpress domain mapping becoming built-in (which I should be aware of :open_mouth: )

@trainoasis I don’t use Valet… been wanting to check that out though, just haven’t had a chance.

I’m on windows so I use WSL, their built in linux kernal, and it all worked locally for me, but I’m not trying to do https locally.

  1. & 2. both sound like valet issue. but I’d double check and make sure you’ve got that https in the network site settings.

  2. Correct, this just relates to your A DNS records, it won’t affect your MX records at all.

  3. Yep :+1:

  4. Since I’m running on Windows, Trellis is not something I use. I’m tried it before, but its just too slow for me on Windows. I’m not sure if it was an issue with my machine or not but I just prefer the WSL route. That said WSL2 is coming out soon and will be much more compatible with Trellis, so I might give it a go soon.

But to answer your question on how to manage stages, bedrock is perfect for this. I used to use capistrano that works great with bedrock… but I don’t really use ruby and capistrano was the only reason I had it installed. One day, it broke on me (a windows thing I think?), so I went looking for deployment alternatives and discovered a php alternative to capistrano called Deployer. Looks like there is a thread on here for how to set it up with Bedrock, I kind of stumbled my way through it so I won’t try to explain my setup as its probably not the best way to do it.

So for multiple stages, I use bedrock’s normal .env to handle config per server and deployer to push my files to each stage as needed. You’d be able to deploy any branch to your staging server for testing features and what not. As far as multisite + handling stages, I might have to do a little config per server/stage, but once its setup its usually good to go.

Let me know if you run into any issues, maybe I can help!

Thanks will look into these options and see how it goes!

This topic was automatically closed after 42 days. New replies are no longer allowed.