Using MW with cloudflare SSL

AHK

Active Member
I am trying to use MW with with SSL from cloudflare.
my site is loading fine like
http://mysite.com
also
https://mysite.com
i found code from
https://kb.mailwizz.com/articles/force-https-instead-http/
to use in .htaccess

but when i put this code in .htaccess
# force https
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,QSA]
in root folder , nothing happen and site open with
http://mysite.com

but when i use code in .htaccess in customer folder , my site redirect to
https://mysite.com/guest/index

as above link suggest to use .htaccess in customer and backend folder stearate , how i use this and force website to https://

Thanks
 
I am trying to use MW with with SSL from cloudflare.
my site is loading fine like
http://mysite.com
also
https://mysite.com
i found code from
https://kb.mailwizz.com/articles/force-https-instead-http/
to use in .htaccess

but when i put this code in .htaccess
# force https
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,QSA]
in root folder , nothing happen and site open with
http://mysite.com

but when i use code in .htaccess in customer folder , my site redirect to
https://mysite.com/guest/index

as above link suggest to use .htaccess in customer and backend folder stearate , how i use this and force website to https://

Thanks
Your control panel may have some settings already, perhaps check there for adjustments/redirects as well.
 
Hello @twisted1919 thanks for quick update.
As you suggest to write in customer and backend area separate as i will be using tracking domains ,

so there is no .htaccess file in customer folder.
i created new .htaccess file in customer folder put this code

# force https
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,QSA]

(eactly above code, do i need to change {HTTP_HOST} , with my host name or not ?

and as i write when i open the site it goto https but wrong
https://mysite.com/guest/index

Thanks
 
Hi @AHK,

What about CloudFlare Page Rules?

You can read more about:
https://support.cloudflare.com/hc/en-us/articles/204144518-SSL-FAQ
https://support.cloudflare.com/hc/en-us/articles/200168306-Is-there-a-tutorial-for-PageRules-

I use this feature basically on all sites, including some rules to disable performance and more aggressive caching options on admin area, bounce process, etc

Attached I'm sending you some screenshots:

MW_Cloudflare-1-page-rules.png MW_Cloudflare-2-page-rules.png MW_Cloudflare-3-page-rules.png

This last rule helped with Mixed Content problem as every object will always served through SSL connections, as this one:
http://www.ftech.com.br/Content/images/clientes/alumni.png

Just take care to test and avoid infinite loops or some problems this may cause.
 
Hello @twisted1919 thanks for quick update.
As you suggest to write in customer and backend area separate as i will be using tracking domains ,

so there is no .htaccess file in customer folder.
i created new .htaccess file in customer folder put this code

# force https
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,QSA]

(eactly above code, do i need to change {HTTP_HOST} , with my host name or not ?

and as i write when i open the site it goto https but wrong
https://mysite.com/guest/index

Thanks
After testing this again, I also found that the instructions in
https://kb.mailwizz.com/articles/force-https-instead-http
do not force httpS, it simply stays on http...
The solution found to force httpS even if you just reload from http is:
(please update kb if apt @twisted1919 thx)

force httpS by adding to the very top of the respctive .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

:D
 
Last edited:
Back
Top