apache mod_rewrite hints

Rewrite if no https and no www

RewriteEngine on

RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://www.test.ee/$1 [L,R]

RewriteEngine on
RewriteCond %{HTTP_HOST}  CONDITION_1 [OR]
RewriteCond %{HTTP_HOST} CONDITION_2 [OR]
RewriteCond %{HTTP_HOST} CONDITION_N [OR]
RewriteCond %{HTTP_HOST} !^www\.test\.ee [NC]
RewriteRule (.*) https://www.test.ee$1 [L,R]

Rewrite if no request uri

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteRule ^(.*)$ http://www.example.com [L,R]

 

domain.com -> www.domain.com

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