SSL codeigniter folder structure

Hi guys, working on a CI application that provides public announcement as well as private (secure) access. I have not implemented SSL yet, but I understand that part of the installation indicates which folders should be accessible using https.

I would like to get some advice on how I should structure my folders in order to facilitate this.

Can a setting affect only the controllers folder? in other words, should application controllers be divided between public and protected subfolders in the standard CI controllers folder?

Do I need to do anything with my views and model folders? What else should I pay attention to?

Your help will be greatly appreciated.

thank

+5
source share
2 answers

OK, the best way to separate things the way you want would be:

  • Set up the CodeIgniter application under the folder, say /var/wwwand make sure that everything works the way you want.
  • Set the base url for the site under config.php CodeIgniter only for "/".
  • Create an Apache virtual host for the secure part of the site by listening to requests for port 443 or something else. Install the certificate and so on. http://www.namecheap.com are good for certificates. Configure the web root as a CodeIgniter folder, e.g. ./var/www.
  • Create another Apache virtual host, pointing to the same directory, for example. / var / www for an unsafe version of the website.

, , , https, http. , , , HTTPS . .

  • CodeIgniter, Ssl.php /. :

class Ssl {

    public function require()
    {
        // Is the current request method secure, via SSL?
        if ( ! isset($_SERVER['https']) )
        {
            // No. Do something here, display an error, redirect... up to you
            show_error("This resource must be accessed through an SSL encrypted connection.");
        }
    }

}

, , $this->load->library('ssl') , SSL, $this->ssl->require() .

require() __construct() , , , .

, .

+3

, CI, HTTPS/SSL.

, . , SSL " ", Apache, .

, Apache, 443, https://example.com, -, /var/www , CI. Apache , . , .

, SSL? ? SSL , .

, .

:

. . SSL-. , SSL/non-SSL, , SSL SSL, " " .., .

, , - vhost root index.php root.php , CI . vhost, , application/controller/private/, CodeIgniter , - .

SSL vhost. - CI / CI... , , , .

0

All Articles