XF 1.5 Force HTTPS to be used via htaccess?

DarkGizmo

Well-known member
I have HTTPS enabled on my hosting, however, is there a way to force it to be used when someone visits my site via HTACCESS?

What would I have to edit in my Xenforo HTACCESS file so when someone visits http://www.nucleusboards.net/boards it brings them to https://www.nucleusboards.net/boards respectively. or if they visit it without the www.

What I want is to force both www. and HTTPS upon my users so no matter what they are always using a secure connection......

How can this be done with my XF1 HTACCESS file?
 
Code:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

The first line will activate the rewrite engine. You can leave it away, if it's already located inside of your .htaccess file for as long as you place the other two lines below it. The second line is the condition under which the url should be rewritten. In that case, it grips when HTTPS is off, e.g. when the user is accessing the url over a non-secure HTTP channel. The third line is the rule, after which the url shall be rewritten. It will redirect the user back to the same url, but over a secure HTTPS channel. This is a HTTP 301 Moved Permanently redirect, so the web browser of the user is essentially told, that he should always access this resource over a HTTPS channel in the future.
 
Back
Top Bottom