I all, I have a strange problem with redirection to HTTPS on Debian running Apache.
- When a user visits http://subdomain.url.nl for the first time, a page not found is reported.
- When the user visits https instead, it works.
- Then user closes the browser, start browser again, and goes to http (without https), the redirect is suddenly working.
I use this rewrite rule. (* hide the IP address in this post)
<VirtualHost 10.*.*.*:80>
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
ReWriteRule ^/(.*) https://%{HTTP_POST}/$1 [NC,R,L]
</VirtualHost>
So, only the "first time" a user visits the site via http, the redirect does not work. Any idea how to solve this?