One site, multiple domains

I got my website running on trellis, everything works correctly. I want to point a second domain to the same site.

Both domains are pointed to the server and I modified group_vars/production/wordpress_sites.yml to look like this:

wordpress_sites:
  exampledomain.com:
    site_hosts:
      - exampledomain.com
      - exampledomain.nl

But the second domain is not yet responding. I’m not looking for a redirection solution (so one domain redirects to another), but rather both domains work on their own, serving the same pages, with their own urls.

Thanks!

Probably going to run into some duplicate content penalties for SEO with that set up.

It recommended to choose a primary domain and forward the other domain to it. You can probably set this up right from your Domain Registrar if you wanted a simple solution.

What you put above won’t work though, you would need two separate sites and one of them would need some nginx rewrite rules to accomplish what you want. But unless you have a specific need, avoid the Google slap and use one domain name.

2 Likes

This. If it’s in 2 different languages it might be a slightly different story but I wouldn’t risk it - I’d use WPML or something like that to help, and then just pick a domain. That said, I’m not an SEO expert.

Wouldn’t know how to do what you’re asking though, sorry :frowning2:

1 Like

I agree WPML or Google Translate would be the way to go for multiple languages on a single site rather than risking it.

As said WPML on a non multisite setup allows a setup for having different domains for each language but you manage 1 site. It also adds the canonical meta and some other things to the so duplicated content isn’t a problem and google will serve the proper language in the serp.

Only problem with me personal preference is that i hate WPML for it’s problems and performance issues (and all the crap it wants to do and you don’t really need) :slight_smile: but for sites with trellis + cache should be ok.

1 Like

I also try to do something like that.

I developed a set of plugins and have a core theme that I use on different pages. Now I want to figure out if it is possible to handle different vhost with the same base setup. Means I want to use always the same plugins and themes from my site directory. In the end I want to have two different repositories. One for trellis and one for my wordpress related stuff.

I tried to configure this, but setting up two sites in group_vars/development/wordpress_sites.yml ends with the problem on vagrant. Both sites are using the same database in the end. The database of the second defined site as mentioned here .

wordpress_sites:
  domain1.com:
    site_hosts:
      - www.domain1.dev
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    admin_email: admin@domain1.com
    ssl:
      enabled: true
      provider: self-signed
    cache:
      enabled: true

  domain2.com:
      site_hosts:
        - www.domain2.dev
      local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
      admin_email: admin@domain1.com
      ssl:
        enabled: true
        provider: self-signed
      cache:
        enabled: true

@kasperientje maybe you can also try to setup your second domain as it’s own site

Thanks for the insights! In my case it wasn’t about different languages, just accessibility. I guess I’ll steer clear and forward one of the domains :slight_smile: