Redirecting *.domain.com to www.domain.com with HTTP or HTTPS prefix
snippet in htaccess

Redirecting *.domain.com to www.domain.com with HTTP or HTTPS prefix

user3524

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule .* http%1://www.domain.com/$0 [R=301,L]