I have already read many question on basic http -> https redirection, but it all talks about the redirect/rewrite including only domain name.
<VirtualHost *:80>
ServerName www.example.com
Redirect / https://www.example.com/
For eg this above snippet will redirect all request to http:www.example.com to https:www.example.com
This ofcourse is the apache recommended way.
But how would we redirect http to https even if request is based on IP.
Like http:ip to https:ip How can this be achieved?
I know that https is for domain name, but I have this particular requirement of client being able to access over IP as well.
Best Answer
Requests using the ip-address (or HTTP 1.0 requests without a
Host:
header) and those for unknown domains are handled by thedefault VirtualHost
which defaults to the firstVirtualHost
entry unless explicitly defined with:So depending on your current configuration:
_default_:80
VirtualHost