RewriteEngine On

RewriteCond %{HTTPS} off
#NOTE:replace with your domain
RewriteCond %{HTTP_HOST} ^(?:www\.)?(yourdomain)\.com$ [NC]
RewriteRule ^ https://%1.com%{REQUEST_URI} [R=302,L,NE]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]