htaccess redirect all subdomains to https except www
snippet in htaccess

htaccess redirect all subdomains to https except www

user3724

Options +FollowSymlinks -MultiViews
RewriteEngine On

RewriteCond %{SERVER_PORT} =80
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]