Answers.Body: <p>The condition should be:</p>
  
  <pre><code>RewriteCond %{HTTPS} !=on
  </code></pre>
  
  <p>(You were missing the <code>=</code> sign.)</p>
  
  <p>For more info, see our help article, <a href="http://buildwithcraft.com/help/force-ssl" rel="nofollow">How do I force SSL for CP requests?</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-06T10:11:11.387Z
Answers.Text: Hi Brandon, thank you for your answer.
  
  Unfortunately adding the `=` sign doesn't resolve the issue. I've tried several approaches but none seem to work. I'm guessing that the problem lies elsewhere. Perhaps it's my MAMP PRO Apache configuration.
Answers.UserDisplayName: Hasco
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-06T15:35:17.000Z
Answers.Text: @hascoulijn Can you add those `[NC,R=301,L]` flags to the end of the `RewriteRule` line, like the help article has?
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-07T13:06:02.560Z
Answers.Text: I was using the exact code from the help article but it didn't work. But it looks like my `http` and `https` connections are treated like separate domains since the `http` completely ignores the `.htacces` while the `https` connection returns an Internal Server Error after inserting some junk value.
Answers.UserDisplayName: Hasco
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-07T15:21:35.707Z
Answers.Text: @hascoulijn In that case you should talk to your host. They may be doing something non-standard and have some advice on how to do this.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-10T13:47:25.607Z
Answers.Text: Ultimately the [help article](http://buildwithcraft.com/help/force-ssl) and your answer were the solution, I just had to figure out how to successfully set up SSL with MAMP first.
Answers.UserDisplayName: Hasco
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-05T23:19:07.843Z
Answers.LastActivityDate: 2014-11-05T23:19:07.843Z
Answers.UserDisplayName: Brandon Kelly
Answers.Body: <p>I fixed this issue by duplicating my host in MAMP PRO without SSL checked, this has to do with the different ports being used for <code>http</code> and <code>https</code> by Apache. So I now have</p>
  
  <pre><code>example.dev
  example.dev with SSL enabled
  </code></pre>
  
  <p><code>http</code> now redirects to <code>https</code> using the code from <a href="http://buildwithcraft.com/help/force-ssl" rel="nofollow">How do I force SSL for CP requests</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-07T13:50:03.523Z
Answers.LastActivityDate: 2014-11-07T13:50:03.523Z
Answers.UserDisplayName: Hasco
Body: <p>I'm having trouble redirecting HTTP to HTTPS with a self assigned SSL certificate generated by MAMP PRO using the following code in my .htaccess:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTPS} !on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  </code></pre>
  
  <p>or</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  </code></pre>
  
  <p>I have also tried the <a href="https://github.com/selvinortiz/craft.patrol" rel="nofollow">patrol</a> plugin for Craft, enabling/disabling dev mode and included  <code>'enableCsrfProtection' =&gt; true,</code> in my <code>general.php</code></p>
  
  <p>Also the .htaccess <a href="http://buildwithcraft.com/help/force-ssl" rel="nofollow">provided by Craft</a> doesn't work for me.</p>
  
Tags: <htaccess><https>
Title: How can I redirect HTTP to HTTPS with a local self assigned SSL certificate in my .htaccess?
ThreadText: # How can I redirect HTTP to HTTPS with a local self assigned SSL certificate in my .htaccess?
  
  (Asked by: username_0 on 2014-11-05)
  
  I'm having trouble redirecting HTTP to HTTPS with a self assigned SSL certificate generated by MAMP PRO using the following code in my .htaccess:
  
  ```
  RewriteEngine On
  RewriteCond %{HTTPS} !on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  
  ```
  
  or
  
  ```
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  
  ```
  
  I have also tried the [patrol](https://github.com/selvinortiz/craft.patrol) plugin for Craft, enabling/disabling dev mode and included `'enableCsrfProtection' => true,` in my `general.php`
  
  Also the .htaccess [provided by Craft](http://buildwithcraft.com/help/force-ssl) doesn't work for me.
  
  **Tags:** htaccess, https
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-11-05. Score: 4 | Accepted answer
  
  The condition should be:
  
  ```
  RewriteCond %{HTTPS} !=on
  
  ```
  
  (You were missing the `=` sign.)
  
  For more info, see our help article, [How do I force SSL for CP requests?](http://buildwithcraft.com/help/force-ssl)
  
  > **Comments:**
  > **username_0**: Hi username_1, thank you for your answer.  Unfortunately adding the `=` sign doesn't resolve the issue. I've tried several approaches but none seem to work. I'm guessing that the problem lies elsewhere. Perhaps it's my MAMP PRO Apache configuration.  
  > **username_1**: @hascoulijn Can you add those `[NC,R=301,L]` flags to the end of the `RewriteRule` line, like the help article has?  
  > **username_0**: I was using the exact code from the help article but it didn't work. But it looks like my `http` and `https` connections are treated like separate domains since the `http` completely ignores the `.htacces` while the `https` connection returns an Internal Server Error after inserting some junk value.  
  > **username_1**: @hascoulijn In that case you should talk to your host. They may be doing something non-standard and have some advice on how to do this.  
  > **username_0**: Ultimately the [help article](http://buildwithcraft.com/help/force-ssl) and your answer were the solution, I just had to figure out how to successfully set up SSL with MAMP first.  
  
  ---
  
  ### Answer by username_0 on 2014-11-07. Score: 1
  
  I fixed this issue by duplicating my host in MAMP PRO without SSL checked, this has to do with the different ports being used for `http` and `https` by Apache. So I now have
  
  ```
  example.dev
  example.dev with SSL enabled
  
  ```
  
  `http` now redirects to `https` using the code from [How do I force SSL for CP requests](http://buildwithcraft.com/help/force-ssl).
  
  
  ---
  
  