Is there a way to force HTTPS protocol in a Kohana 2.3 site?

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2010-06-10T01:44:53Z Indexed on 2010/06/10 1:52 UTC
Read the original article Hit count: 327

Filed under:
|
|
|

I've got a site built on top of Kohana 2.3 which I now have to make all links https.

I set this in application/config/config.php.

$config['site_protocol'] = 'https';

This makes all links on the site use the https protocol.

Except, when I first enter the site via http, it will not automatically forward to https.

Is there a way to make Kohana do this, or do I just need to do some custom coding?

I've found this .htaccess rule too, will it be fine to just drop this in?

RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://yourdomain.tld%{REQUEST_URI} [NS,R,L]

Thanks.

© Stack Overflow or respective owner

Related posts about http

Related posts about https