Secure https pages not resolving

3 posts / 0 new
Last post
#1 Wed, 05/23/2018 - 08:37

Secure https pages not resolving

Hullo there, Virtualminners!

I am in the process of upgrading my site to https, because I will be adding payment services which will require transfer of financial information.

Try as I might, I can not get the pages to resolve in https.

If I type "" in the address field, it DOES resolve to https, and give me the "lock" symbol and certificate information. So I think that all is set up correctly for security.

However, if I type "", the page resolves to — not what I want. In fact, what I want is when anyone tries to go to any variation of the domain, including "", that they be redirected to "".

This is frustrating, as I thought I made the requisite changes in my Virtualmin panel. Particularly, this setting:

System settings / Virtualmin Configuration / SSL Settings / Redirect HTTP to HTTPS by default?

Is set to "Yes".

Is there something I am missing? Let me know if you need any information that I have not provided.

Note that when I log into the Virtualmin panel, the Virtualmin panel pages do resolve to https, i.e.:

My html files are located at: /home/mydomain/public_html/

Thanking you in advance.


Wed, 05/23/2018 - 15:46
Diabolico's picture

If you dont have create .htaccess file and add:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]

This will redirect anything to https://www... so free to edit as you want, and it will work with any domain (just copy/paste).

- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.

Thu, 05/24/2018 - 08:11

Thank you, Diabolico.

I have used this htaccess method with other sites for which I do not have root access. I just thought that there might be a Virtualmin setting that would allow me to easily toggle this on/off. And I didn't want to edit the apache config for fear of breaking it. :-P

This will work for now; but – anyone – if ever a better alternative arises, please let me know.

Diabolico and everyone: enjoy the coming weekend!


Topic locked