Force https and www in with one redirect

Keywords: LAMP/MAMP/WAMP - AWS - Technical issue - Application configuration

bndiagnostic ID: ac921601-db43-11e5-8ef1-7cfb00c50987

bndiagnostic output:

? Apache: Found possible issues
? Resources: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/
https://docs.bitnami.com/bch/apps/moodle/troubleshooting/deny-connections-bots-apache/

bndiagnostic failure reason: The suggested guides are not related with my issue

Description:
Dear help team!

I have added the following code to my .htaccess file which already works fine for redirecting to my 404 page as well as removing .php extensions:
RewriteCond %{HTTP_HOST} !^www.(.)$ [OR,NC]
RewriteCond %{https} off
RewriteRule ^(.
)$ https://www.mysite.com/$1 [R=301,L]
It should redirect from http://mysite.com to https://www.mysite.com but seems to be completely ignored. Instead there is a redirect from http://mysite.com to http://www.mysite.com at first and then another one to https://www.mysite.com.

Do you have any idea what is causing this behavior?
I thought perhaps there is some other configuration file somewhere else on the server that is also doing redirects.

redirect-checker.org tells me that the first redirect from http://mysite.com to http://www.mysite.com is coming from Apache and the second one from http://www.mysite.com to https://www.mysite.com is coming from CloudFront (I am using Amazon Lightsail).

I hope I am being clear.

Thanks and kind regards,

Matt

Hi @IAmGrateful,

Can you check the following guide:

https://docs.bitnami.com/general/apps/wordpress/administration/force-https-apache/

Regards,
Michiel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.