# Secure https pages not resolving

**URL:** <https://forum.virtualmin.com/t/secure-https-pages-not-resolving/58436>\
**Category:** Help! (Home for newbies)\
**Created:** [May 23, 2018, 1:37pm UTC](https://forum.virtualmin.com/t/secure-https-pages-not-resolving/58436 "2018-05-23T13:37:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parapluie](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@Parapluie](https://forum.virtualmin.com/u/Parapluie)\
**Post date:** [May 23, 2018, 1:37pm UTC](https://forum.virtualmin.com/t/secure-https-pages-not-resolving/58436/1 "2018-05-23T13:37:45Z")

</div>

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 “[https://mydomain.com](https://mydomain.com)” 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 “[mydomain.com](http://mydomain.com)”, the page resolves to [http://mydomain.com](http://mydomain.com) — not what I want. In fact, **what I want is when anyone tries to go to _any variation_ of the domain, including “[http://mydomain.com](http://mydomain.com)”, that they be redirected to “[https://mydomain.com](https://mydomain.com)”.**

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.: [https://ded.mydomain.com:10000/virtual-server/…](https://ded.mydomain.com:10000/virtual-server/%E2%80%A6)

My html files are located at: /home/mydomain/public\_html/

Thanking you in advance.

-K

---

<div class="post-metadata">

**Author:** ![Diabolico](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@Diabolico](https://forum.virtualmin.com/u/Diabolico)\
**Post date:** [May 23, 2018, 8:46pm UTC](https://forum.virtualmin.com/t/secure-https-pages-not-resolving/58436/2 "2018-05-23T20:46:18Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Parapluie](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@Parapluie](https://forum.virtualmin.com/u/Parapluie)\
**Post date:** [May 24, 2018, 1:11pm UTC](https://forum.virtualmin.com/t/secure-https-pages-not-resolving/58436/3 "2018-05-24T13:11:08Z")

</div>

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. 😛

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

Diabolico and everyone: enjoy the coming weekend!

K

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [April 30, 2020, 5:38am UTC](https://forum.virtualmin.com/t/secure-https-pages-not-resolving/58436/4 "2020-04-30T05:38:10Z")

</div>

Closed on April 30, 2020, 5:38am UTC


