Hi,
I would like to modify my apache configuration file in order to redirect all traffic to HTTPS except if it comes from localhost (to access for instance to phpMyAdmin).
I already read this and this since I am using the IF-ELSE directive.
Also, you're matching if the HTTP host is equal to "localhost". Don't you mean "NOT equal to"? I.e., !=?
This is more "generic Apache configuration" than that it is related to Let's Encrypt or TLS by the way. The fact you're attempting not to redirect to HTTPS makes it a liiiiiitle bit related, but it's not much.. Also, you're not providing much debugging info. Do you get warnings? Errors? What works? What doesn't? On many generic computer communities your thread would probably be closed immediately.
Hi,
thank you for your fast reply. You are right OR is || as in C style and I forgot ! -> !=. I have not tried yet, since I do not know about apache syntax and after the server upgrade I found this discussion.
Do you think I should ask in a different forum?
<If "%{REQUEST_URI} !~ m#/.well-known/acme-challenge/#" || "%{HTTP_HOST} != 'localhost'">
Redirect permanent / https://example.com/
Do you know if the above does what I want? Redirect all traffic to HTTPS except ACME challenges and localhost?
Thank you
Maybe, or you just might have gotten a fix already.
I'm not knowledable about these Apache If-expressions. I just mentioned what I read in the documentation. I'm not going to learn these If-expressions just to see if this works, you need to test for yourself.