URL redirection condition from http to https

Hi All,

Please help me to write the url rewrite condition for my domain. my concern is, if i give
mydomain.in or www.mydomain.in, it should redirect to https://www.mydomain.in.

i have given as fallows but it is not working. With this condition, when i give mydomain.in, it is going to http://mydomain.in.
when i give www.mydomain.in, it is going to https://www.mydomain.in.

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Please help me in this issue.

Hello,

Use this:

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