<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Latest snippets tagged server sysadmin http</title>
  <link rel="alternate" href="http://snippets.prendreuncafe.com/snippets/tagged/server+sysadmin+http/order_by/date"></link>
  <id>http://snippets.prendreuncafe.com/snippets/tagged/server+sysadmin+http/order_by/date</id>
  <updated>2006-12-19T11:35:21Z</updated>
  <author>
    <name>Symfony</name>
    <author_email>noreply@symfony-project.com</author_email>
  </author>
<entry>
  <title>Redirect HTTP -&gt; HTTPS requests in a VirtualHost</title>
  <link href="http://snippets.prendreuncafe.com/snippet/26"></link>
  <updated>2006-12-19T11:35:21Z</updated>
  <id>26</id>
  <summary type="html">[code]
&lt;VirtualHost 100.101.102.103:80&gt;

  ServerName    subdomain.domain.tld
  DocumentRoot  /path/to/docroot

  &lt;IfModule mod_rewrite.c&gt;
    RewriteEngine   on
    RewriteLog      /var/log/apache2/https_rewrite.log
    RewriteLogLevel 1
    RewriteCond     %{SERVER_PORT} !^443$
    RewriteCond     %{SERVER_NAME} ^subdomain.domain.tld$
    RewriteRule     ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
  &lt;/IfModule&gt;

&lt;/VirtualHost&gt;

&lt;VirtualHost 100.101.102.103:443&gt;

  ServerName    subdomain.domain.tld
  DocumentRoot  /path/to/docroot

  SSLEngine On
  SSLCertificateFile     /etc/apache2/ssl_conf/myservicename.crt
  SSLCertificateKeyFile  /etc/apache2/ssl_conf/myservicename.key


&lt;/VirtualHost&gt;
[/code]</summary>
</entry>
</feed>