I am trying to redirect only a login page on my site from http to https
The site is load-balanced on 2 servers, and when I enable the rewrite rule on one webserver, things work fine. When I enable the identical rule on both servers, it seems to break the page - it never loads, caught in a loop.
What I intend to do is:
- Check if the page requested is HTTPS
Redirect to https://example.net/login/ if the requested page is one of these:
Here's the rule I created, copied and pasted onto both servers identically in httpd.conf
<Directory "/var/www/html">
RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule ^login(/index.html|/)?$ https://example.net/login/ [R=301,L]
. . . many more redirect rules below
RewriteRule ^something-more(.*)$ /ok-whatever/$1 [R=301,L]
Can you see what the problem might be ? Is it something about the load-balancing that is throwing this into a loop ? For example is %{HTTPS} not being updated ?
Thanks,