Apache HTTP to HTTPS redirects


The Apache web server provides a flexible and customizable web hosting environment, and contains a plethora of features. One nice feature is the ability to redirect clients to different areas of a site based on URL location, or the port they are connecting to. Redirection is accomplished with the “Redirect” and “RedirectMatch” directives, which are part of the mod_alias module. To redirect all HTTP:// connections to HTTPS://, you can setup a VirtualHost, and use the Redirect directive to forward all requests to a secure URL:

<VirtualHost *:80>
Redirect permanent / https://www.daemons.net/something/blah.jsp
</virtualhost>

This assumes that non-secure connections are terminated on TCP port 80, and secure connections are terminated on TCP port 443.

This article was posted by Matty on 2005-02-18 23:15:00 -0400 -0400