<p>The second one will force SSL no matter which page you're on, including any control panel requests, which is what you're after. As mentioned in the docs, make sure that goes above Craft's default rewrite code. </p>

<p>The only other thing you'll want to do is change the site URL in Craft itself; you can do that in <code>Settings -&gt; General</code> so Craft knows to spit out secure versions of any links or assets in your site, otherwise your visitors be redirecting from non SSL to SSL with every link (which will slow your server down and potentiallly confuse google).</p>

<p><img src="https://i.sstatic.net/RRnyB.png" alt="enter image description here"></p>

<p>For what it's worth, Arcustech's config didn't work for me, probably difference in server setups since I don't host with them, but I usually use something like:</p>

<pre><code>RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://yoursite.com/$1 [R,L]
</code></pre>

<p>That basically means if it's on port 80 (non SSL), redirect to the secure version.  Use whichever works for you.</p>

CC BY-SA 3.0
2015-06-10T22:02:46.903Z
2015-06-10T22:02:46.903Z
RitterKnight
<p>This worked for me on the Arcustech server:</p>

<p>Put this code in the root .htaccess file:</p>

<pre><code>&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On

# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]

# SSL only
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !^https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
</code></pre>

<p></p>

<p>As RitterKnight mentioned you also need to modify your site's "Site URL" in <code>Settings&gt;General</code> to be <code>https://</code>.</p>

CC BY-SA 3.0
2015-06-16T18:45:02.380Z
Good to hear you got it humming!
RitterKnight
CC BY-SA 3.0
2016-10-25T10:39:01.490Z
The code above does force a redirect to https but with horrible unintended consequences for me. If I type in http://www.mydomain.com/news, the resulting redirect URL becomes https://www.mydomain.com/index.php?p=news which is awful if i'm trying to use this for 301 redirects. Does anyone know how to fix that?
Mike
CC BY-SA 3.0
2016-10-26T00:37:52.860Z
I'm having the same issue as you Mike. Usually I like to do this manually, but in this case I opted for the [patrol plugin](https://github.com/selvinortiz/craft.patrol)
Jared
CC BY-SA 4.0
2021-02-23T22:21:12.013Z
Just noting that issues with the post-redirect URI and query string can be solved by placing the HTTPs (or non-www) redirection rules *above* Craft's. Thanks to Arcustech support for pointing this out!
August Miller
CC BY-SA 3.0
2015-06-16T13:18:37.750Z
2015-06-16T13:18:37.750Z
Lori
<p>I want to use SSL (https) for my entire website which is hosted on Arcustech.  I came across two instructions, one on Craft's site which discusses forcing SSL on the CP and the other is from Arcustech's site which discusses forcing SSL on entire site.  I'm not sure if I can just use the Arcustech's version or if I need a combo because I want the CP to be SSL too.</p>

<p>Here's the code for the two versions:</p>

<p>Craft Forcing SSL on CP (<a href="http://buildwithcraft.com/help/force-ssl" rel="noreferrer">direct link</a>)</p>

<pre><code>&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On

# Force SSL for CP requests
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteCond %{REQUEST_URI} ^/admin/ [NC]
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
</code></pre>

<p></p>

<p>Arcustech Forcing SSL for entire site</p>

<pre><code>RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !^https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</code></pre>

<p>Thank you!</p>

<p>Lori</p>

CC BY-SA 3.0
2015-06-16T13:20:11.337Z
I posted my answer below with contains the code that worked on my Arcustech server.
Lori
<htaccess><ssl>
Using SSL for entire website on Arcustech server
# Using SSL for entire website on Arcustech server

(Asked by: username_0 on 2015-06-10)

I want to use SSL (https) for my entire website which is hosted on Arcustech.  I came across two instructions, one on Craft's site which discusses forcing SSL on the CP and the other is from Arcustech's site which discusses forcing SSL on entire site.  I'm not sure if I can just use the Arcustech's version or if I need a combo because I want the CP to be SSL too.
Here's the code for the two versions:
Craft Forcing SSL on CP (direct link)

RewriteEngine On

# Force SSL for CP requests
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteCond %{REQUEST_URI} ^/admin/ [NC]
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]


Arcustech Forcing SSL for entire site
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !^https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Thank you!
Lori

**Tags:** htaccess, ssl
> **Comments:**
> **username_0**: I posted my answer below with contains the code that worked on my Arcustech server.  

---

## 2 answers

### Answer by username_0 on 2015-06-16. Score: 9 | Accepted answer

This worked for me on the Arcustech server:
Put this code in the root .htaccess file:

RewriteEngine On

# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]

# SSL only
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !^https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 


As RitterKnight mentioned you also need to modify your site's "Site URL" in Settings>General to be https://.

> **Comments:**
> **username_1**: Good to hear you got it humming!  
> **username_2**: The code above does force a redirect to https but with horrible unintended consequences for me. If I type in http://www.mydomain.com/news, the resulting redirect URL becomes https://www.mydomain.com/index.php?p=news which is awful if i'm trying to use this for 301 redirects. Does anyone know how to fix that?  
> **username_3**: I'm having the same issue as you Mike. Usually I like to do this manually, but in this case I opted for the [patrol plugin](https://github.com/selvinortiz/craft.patrol)  
> **username_4**: Just noting that issues with the post-redirect URI and query string can be solved by placing the HTTPs (or non-www) redirection rules *above* Craft's. Thanks to Arcustech support for pointing this out!  

---

### Answer by username_1 on 2015-06-10. Score: 3

The second one will force SSL no matter which page you're on, including any control panel requests, which is what you're after. As mentioned in the docs, make sure that goes above Craft's default rewrite code. 
The only other thing you'll want to do is change the site URL in Craft itself; you can do that in Settings -> General so Craft knows to spit out secure versions of any links or assets in your site, otherwise your visitors be redirecting from non SSL to SSL with every link (which will slow your server down and potentiallly confuse google).

For what it's worth, Arcustech's config didn't work for me, probably difference in server setups since I don't host with them, but I usually use something like:
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://yoursite.com/$1 [R,L]

That basically means if it's on port 80 (non SSL), redirect to the secure version.  Use whichever works for you.


---

