[Solved] How to find htaccess file or automatically redirect to HTTPS?

OS type and version CentOS Linux 7.9.2009
Virtualmin version 7.1

I created a htaccess file and inserted the code from this link (Problem with Virtualmin, Letsencrypt and redirect to https in the .htaccess file - #2 by Diabolico)

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]

I pasted it into my File Manager area:


However, links to these sites are still not automatically redirected to the HTTPS version.

How can I fix this?


But they are. I have good news. When I click on the links you have listed, the secured site for the link loads in my browser.

1 Like

Thank you Neil, I managed to configure something. Putting it in the htaccess does not work actually.

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