Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $hook['post_controller_constructor'][] = array(
- 'function' => 'redirect_ssl',
- 'filename' => 'ssl.php',
- 'filepath' => 'hooks'
- );`
- function redirect_ssl() {
- $CI =& get_instance();
- $class = $CI->router->fetch_class();
- $exclude = array('client'); // add more controller name to exclude ssl.
- if(!in_array($class,$exclude)) {
- // redirecting to ssl.
- $CI->config->config['base_url'] = str_replace('http://', 'https://', $CI->config->config['base_url']);
- if ($_SERVER['SERVER_PORT'] != 443) redirect($CI->uri->uri_string());
- } else {
- // redirecting with no ssl.
- $CI->config->config['base_url'] = str_replace('https://', 'http://', $CI->config->config['base_url']);
- if ($_SERVER['SERVER_PORT'] == 443) redirect($CI->uri->uri_string());
- }
- }
- Esta página não está funcionando
- Redirecionamento em excesso por meusite.com
- Tente limpar os cookies.
- ERR_TOO_MANY_REDIRECTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement