HTTPS and .htaccess

Brandon

New Member
I have enabled HTTPS in the backend of mailwizz, which seems to work great for most devices, but for some reason, mobile devices still won't redirect to the "https://www" secured version.

I was going to push http to https and non-www to www in .htaccess to help aid this. I was planning on using something like this:

RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.example.com%{REQUEST_URI} [L,R=301]

However, I stumbled across this article (https://kb.mailwizz.com/articles/when-using-web-api-delivery-servers-bounce-processing-doesnt-work/) you wrote about the bounce processing url.

What's the correct code for .htaccess so that I can forward http to https and non-www to www while exluding that bounce processing url?
 
@Brandon - The article says like so because most people register their delivery servers while on http and mailwizz creates http webhooks in this case which would later cause issues if https would be enabled and a redirect would happen.
If you haven't created any delivery server just yet, it is safe to force https everywhere and then create the delivery servers so that mailwizz can register https webhooks (please double check afterwards).

Another thing you can do, is that you can put a .htaccess with http => https redirect just in /backend and /customer folders, this way the fronted remains untouched.

If you need full redirect, then you can exclude the dswh path as follows:
(this is the frontend app part only from the rules that mailwizz will generate for you from backend > settings > common > enable clean urls)
Code:
# BEGIN rewrite rules
[...]
<IfModule mod_rewrite.c>
    [...]
    # FRONTEND APP
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule . index.php

    # this was added
    RewriteCond %{HTTPS} !=on
    RewriteCond %{REQUEST_URI} !^/dswh*?$ 
    RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,QSA]
</IfModule>
[...]
 
Back
Top