How to redirect one subdomain to one specific page when another subdomain is the main domain

I have a website with two subdomain:

I would like to redirect to with this config

  - canonical:
  - canonical:
local_path: ../site
repo_subtree_path: site
branch: master
  enabled: false
  enabled: true
  provider: letsencrypt
  hsts_max_age: 31536000
  hsts_include_subdomains: false
  hsts_preload: true
  enabled: true

The two domains use ssl and letsencrypt. I tested a lot of things but everytime the domain redirect to Even when I remove to the canonical list… I tested every 301 redirection possible in the nginx conf directly without success.

Any ideas ?

There’s a redirects key you could use to do this. Check out the docs for more info.
Give that a try and see how you get on.

Maybe I miss understood but redirects will only redirect domains to the main domain right ?

Yes that’s correct. I guess you have two options:

  1. Use a redirect in WP (there’s lots of plugins for this)
  2. Use the Nginx includes feature in Trellis. It even discusses the rewrites use case.

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