• SupportNginx
  • Redirect all subdomains but www and root domain to another subdomain?

Hello WordOpsErs! If I add this to my default nginx conf would work and do I need to apply again every time I update WordOps?

server {
    # Match all subdomains except www and root domain
    server_name ~^(?!www\.)(?<subdomain>.+)\.example\.com$;

    # Redirect to another subdomain (e.g., redirect.example.com)
    return 301 https://redirect.example.com$request_uri;
}

Hosted by VirtuBox