So far I have .htaccess file which is able to redirect correctly from (domain.com
) to (https://www.domain.com
) but not working if I go to www.domain.com
and it must redirect (www.domain.com
) to (https://www.domain.com
)
I need (https://www
) always before my site url
my .htaccess file
RewriteEngine On
RewriteCond !{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d