title: Enable https using Rewrite Rule for specific URLs
body: <p>I am new to Apache and I am finding it extremely difficult to understand the rewrite rule syntax.</p>
  
  <p>Here is my setup:
  I have a Wordpress MU site at mydomain.com
  I have parked domains site1, site2.com that point to mydomain.com</p>
  
  <p>What I want:
  I want this URL <a href="http://mydomain.com/wp-login.php" rel="nofollow">http://mydomain.com/wp-login.php</a> to redirect to the same address but with https first. I have seen several tutorials on how to do this but there is a problem.</p>
  
  <p>My problem:
  If I use something like</p>
  
  <pre><code>#RewriteCond %{HTTPS} !=on
  #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </code></pre>
  
  <p>this also redirects my other sites to https versions because they are parked domains and effectively loading the same htaccess code; since the certificate I have is only for mydomain.com I get certificate errors.</p>
  
  <p>I need to only secure pages on the mydomain.com but only the wp-login.php page. Another issue is that this page can move around in the URL, IE:</p>
  
  <p>mydomain.com/wp-login.php</p>
  
  <p>mydomain.com/somecracp/wp-login.php</p>
  
  <p>mydomain.com/wp-login.php?xys=5653</p>
  
  <p>I need a regex which will detect the domain name of mydomain.com and the wp-login.php anywhere in the URL. I then need to force https for them. Can anyone build me the code please?</p>
  
  <p>UPDATE:
  I may have found part of the issue. It would seem that the login page itself is also trying to do some redirection. When I access the admin section of the site <a href="http://mysite.com/wp-admin" rel="nofollow">http://mysite.com/wp-admin</a> it detects that you aren't logged in; it then redirects you to the login page but appends a redirect_to query string at the end like so:</p>
  
  <pre><code>http://mydomain.com/subdomain/wp-login.php?redirect_to=http%3A%2F%2Fmydomain.com%2Fsubdomain%2Fwp-admin%2F&amp;reauth=1
  </code></pre>
  
  <p>It seems to do this so that once you log in successfully it can redirect you to the admin section you previously tried to access. This "redirect_to" and what comes after it is the URL it will redirect to once you log in.</p>
  
  <p>I won't to go into details as to why but is there a way I can force it overwrite the above URL to go to mydomain.com/wp-login.php with none of the rediret_to crap?</p>