I have an apache 2 server and I a wildcard https certificate for all my subdomains. But I do not have one for sub subdomains.
Here's an example:
https://example.com = secure
https://wildcardsubdomain.example.com = secure
https://www.wildcardsubdomain.example.com = warning unsecure
I am trying to do a mod_rewrite to get rid of any trailing wwws.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
But I found out I cannot rewrite before the security check. How can I overcome this issue and move from the www. to the non www.?