Hello,
I hope all are safe.
How can I force nextcloud to redirect to https?
I tried to use
Force HTTPS overwrite
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
but HTTP traffic is not redirected to HTTPS.
I’m hosting on One.com shared hosting.
Can someone help me?
Thank you
.htaccess works for me:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
With certbot and Lets Encrypt it is automatic better configured in apache2-conf.
I hate that obfuscated “rewrite” nonsense. It’s hard to read and debug.
Instead, my vhosts.conf uses a clear:
<VirtualHost *:80>
ServerName cloud.darksteve.tk
Redirect permanent / https://cloud.darksteve.tk/
</VirtualHost>
That is clear and easy to understand. I hope that helps!
1 Like