Feb 27, 2012

Apache HTTP to HTTPS Redirect


Here's a micro-nugget. The following Apache config redirects incoming HTTP traffic to the equivalent HTTPS page. Nothing special but I don't spend enough time working on Apache configurations to keep this stuff fresh in my mind so I find it useful to record what I learn in case I need to do it again later.

<virtualhost *:80>
  RedirectMatch permanent /(.*)$ https://example.com/$1
</virtualhost>

<virtualhost *:443>
  ServerName example.com
  # config...
</virtualhost>

No comments: