Welcome Guest, Not a member yet? Register   Sign In
ssl on certain controller
#1

[eluser]huuray[/eluser]
Hi all,
my ssl directory is shared.
Used a symbolic link from private_html to public_html(allows for same data in http and https)

and the problem is,certain controller does no need ssl,
when i type https://domain/controller_no_need_ssl it will open too.

actually i want to off ssl as default,only certain controller can use ssl.
any idea?

sorry for poor english Sad
#2

[eluser]skunkbad[/eluser]
Code:
public function __construct()
    {
        parent::__construct();

        if(!isset($_SERVER['HTTPS']))
        {
            $this->load->helper('string');
            header("Location: " . secure_base_url() . trim_slashes( $this->uri->uri_string() ) . url_suffix(), TRUE, 301);
            exit;
        }
    }
#3

[eluser]huuray[/eluser]
thanks skunkbad,but,when i open https://domain/controller_no_need_ssl it will open too.
#4

[eluser]skunkbad[/eluser]
[quote author="huuray" date="1278652026"]thanks skunkbad,but,when i open https://domain/controller_no_need_ssl it will open too.[/quote]

So just modify the code to go the other way. It's just simple PHP...
#5

[eluser]huuray[/eluser]
thanks for the answer.
but i want it to load by default to all new controller.no need to put this code every time to create a new controller

Code:
parent::__construct();

        if(isset($_SERVER['HTTPS']))
        {
            $this->load->helper('string');
            header("Location: " . base_url() . trim_slashes( $this->uri->uri_string() ) . url_suffix(), TRUE, 301);
            exit;
        }


any idea ?
#6

[eluser]skunkbad[/eluser]
[quote author="huuray" date="1278652817"]thanks for the answer.
but i want it to load by default to all new controller.no need to put this code every time to create a new controller

Code:
parent::__construct();

        if(isset($_SERVER['HTTPS']))
        {
            $this->load->helper('string');
            header("Location: " . base_url() . trim_slashes( $this->uri->uri_string() ) . url_suffix(), TRUE, 301);
            exit;
        }


any idea ?[/quote]

You could extend the Controller class and put this construct there. I am suspicious that you are doing something wrong though. Forcing HTTP from HTTPS is not something that you should worry about. Who cares if somebody is in HTTPS? How did they get there? Why would it matter?
#7

[eluser]huuray[/eluser]
actualy i want to enable https for user controller login function only,
why https for normal page like blog post.
#8

[eluser]skunkbad[/eluser]
[quote author="huuray" date="1278653389"]actualy i want to enable https for user controller login function only,
why https for normal page like blog post.[/quote]

That's what I'm saying.




Theme © iAndrew 2016 - Forum software by © MyBB