I want to forward all traffic to https. There can be subdomains and subpaths in the URL that should stay intact. Example:
http://subdomain.myDomain.me -> https://subdomain.myDomain.me
http://myDomain.me/subpath -> https://myDomain.me/subpath
http://subdomain.myDomain.me/subpath -> https://subdomain.myDomain.me/subpath
I tried the examples in this neat evaluator (link from here) with the following code:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https:/$1
In the evaluator, everything is fine. The real virtual host looks like this:
<virtualHost *:80>
ServerName myDomain.me
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https:/$1
</VirtualHost>
When trying to acces the real site, this happens:
http://subdomain.myDomain.me -> http://subdomain.myDomain.me # fail - no https
http://myDomain.me/subpath -> https://myDomain.mesubpath # fail - subpath appended to top-level domain
http://subdomain.myDomain.me/subpath -> https://subdomain.myDomain.me/subpath # success
What is wrong with this rewrite?