I enabled SSL in cloudflare on Flexible option, and I set Automatic HTTPS rewrites to ON.
I want the following:
example.com
www.example.com
to redirect all of them to
What are the redirect rules that I have to add inside cloudflare website? I tried to write rules inside .htaccess but it didn't work.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]