Score:0

Apache2 http https redirect not working (ErrorDocument or 400 Bad Request)

lb flag

I'm trying to redirect http to https
I have sevral sub domains and use sevral port.

I wnat to redirect 80 port to 443 port automatically.
I have httpd.conf / vhosts.conf / ssl.conf
so when i type https://example.com, it's working well
but when i type just 'example.com' or 'http://example.com' or
www.example.com goes to error page.

It's my first try to make http to https redirect on vshots.conf

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

however, it goes to ErrorDocument when i check developer toop, domain.com goes 301 code
and then load error.html.var which is ErrorDocument
I didn't set 301 code goes to error.html.var but I have no idea why they load that.

I guess the server doesn't get {HTTP_POST} well but I don't know how to check

so I changed to the below
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/

and now it goes to 400 bad request that server couldn't understand. Could you give me an advice?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.