How to force https to any http page request on an Apache 2.4 server

Vic asked:

I saw a solution to this at HTTP to HTTPS redirect not working on Apache 2.4

<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
Redirect permanent "/" "https://www.example.com/"
</VirtualHost>

My question is, doesn’t this directive send any and all page requests on a site to https://www.example.com/?

How do you get http://www.example.com/someDir/somePage.html to resolve to https://www.example.com/someDir/somePage.html using Apache 2.4 directives?

My answer:


The documentation states:

Additional path information beyond the matched URL-path will be appended to the target URL.

So you don’t do anything else.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.