Redirecting urls to a subdomain without http

Recently migrated a site onto Trellis/Bedrock/Roots. The legacy site was repointed to a subdomain and the previously existing SSL certs were also moved over. A number of client specific portals remain on the legacy system, which is no longer running any pages via SSL. I created some nginx rewrites using the Trellis includes process so that users could still access secure portals via the same www urls they have bookmarked. The issue I’m having is that these redirects are all rewriting to https. I’m not sure if this is a Trellis configuration thing or just an error on my part in the rewrites. Syntax I’ve tried so far is:

location ~* ^/4-h-canada/?$ { rewrite ^ permanent; }


location ~* ^/4-h-canada/?$ { return 301; }

The goal is to get to from all variants of

Edit: This appears to only occur when the scheme is specified and no subdomain is specified. e.g. and redirect to the https subdomain, whereas or just work fine. I’d appreciate any insight on this.

I’m assuming it’s an HSTS issue if you haven’t customized it. Trellis defaults to enable it since it’s better for security.

Docs here for more details:

You’ll want to disable it or at least the subdomains feature.