redirect from non-www to www

I have a website that doesn’t seem to redirect from non-www to www onnly in one condition.
if i type https://example.com it dosen’t redirect
and if id write http://exmple.com or example.com without http it works great
i wrote this to my htaccess

Force https and www:

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

any help will be appreciated

Read more here: redirect from non-www to www

Leave a Reply

Your email address will not be published. Required fields are marked *