Apache: redirect http to https 

Joined:
04/19/2010
Posts:
75

July 08, 2010 21:27:56    Last update: July 08, 2010 21:27:56
To redirect all HTTP traffic to HTTPS, add the Redirect directive to the HTTP VirtualHost:
<VirtualHost _default_:80>
    Redirect permanent / https://www.example.com/
</VirtualHost>


The general syntax is:
Redirect [status] URL-path URL

By the Apache httpd doc, any request beginning with URL-Path will return a redirect request to the client at the location of the target URL.

However, the proxy directives does not seem to respect this rule. So it's best to place the proxy directives inside the HTTPS VirtualHost:
<VirtualHost _default_:443>
.
.
.
ProxyRequests Off
ProxyPass /tomcat http://127.0.0.1:8080/tomcat
ProxyPassReverse /tomcat http://127.0.0.1:8080/tomcat
.
.
.
</VirtualHost>
Share |
| Comment  | Tags