Using HTTPS with CodeIgniter

Using SSL is a huge topic, as is online security in general; therefore, I strongly recommend you read widely about web security (because this recipe isn't really a security primer). However, if you specifically wish to protect certain pages with an SSL certificate, there is an easy way to do it. We can create a CodeIgniter helper file to toggle SSL support on or off. Let's see how to do it.

Getting ready

I'm sure you know of the benefits of requiring certain pages in a website to be protected with an SSL certificate. The sight of that green address bar and little padlock can go a long way in allaying a user's concerns with entering data in a website. CodeIgniter doesn't come with SSL support built-in; however, it is ...

Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.