I'm trying to redirect all my foo.mydomain.com requests to https://foo.mydomain.com.
My VirtualHost contains this:
<VirtualHost *:443>
ServerName foo.mydomain.com
# Indexes + root dir
DirectoryIndex index.html
DocumentRoot /home/web/foo.mydomain.com/htdocs
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
SSLVerifyClient none
<IfModule mime.c>
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
</IfModule>
# Logfiles
ErrorLog /home/web/foo.mydomain.com/logs/error.log
CustomLog /home/web/foo.mydomain.com/logs/access.log combined
</VirtualHost>
So now I'm trying to redirect all the http-request to https with mod_rewrite in this .htaccess file:
Options FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://foo.mydomain.com
Does anyone knows what I'm doing wrong? Thank you in advance!