donjakobo/A3M

About SSL

Closed this issue · 10 comments

Site does not open after SSL installation.
I got "ERR_TOO_MANY_REDIRECTS" error.

.htaccess

RewriteEngine on
RewriteRule ^$ /ci/a3m/index.php [L]
RewriteCond $1 !^(index.php|resource|system|user_guide|bootstrap|robots.txt|favicon.ico)
RewriteRule ^(.*)$ /ci/a3m/index.php/$1 [L]

config.php

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';

$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';

account.php

$config['ssl_enabled'] = TRUE;

anyone have any idea about this?

Thank you!

Looks like an issue with .htaccess. This is my .htaccess on a site that is using SSL:

Options +FollowSymLinks
#http://softkube.com/blog/url-rewriting-for-codeigniter/
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]


# Removes index.php from URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

Try to adapt this and see what happens.

/application/helpers/account/ssl_helper.php

//header('Location: '.current_url().(empty($_SERVER['QUERY_STRING']) ? '' : '?'.$_SERVER['QUERY_STRING']));

Comments header solved
but any other idea?

Dear @AdwinTrave
Thank you.
I used your .htaccess but the same issue.

Dear @AdwinTrave

/application/controllers/home.php
line 7 maintain_ssl();
change to maintain_ssl($this->config->item("ssl_enabled"));

If account.php set
$config['ssl_enabled'] = TRUE;
go https://your.domain.com
No error.

but set
$config['ssl_enabled'] = FALSE;
go https://your.domain.com

got error
ERR_TOO_MANY_REDIRECTS

Are you using the 1.x version or 2.x? In 2.x I moved maintain_ssl() into the library initialization function and set it how you have it here. Other than that, the only issue here seems to be that it is not redirecting properly from the ssl url when ssl is turned off.

It's version 2.x

You might want to update to the latest.
Now maintain_ssl() is in a new functionality in the Authentication library.
For home controller it should look like this:

$data = $this->authentication->initialize(FALSE);

Thanks @AdwinTrave
But in ver 2.x that's an error?

This is new in 2.x. You want to make sure that you have up-to-date version of the libraries for that. The initialize function is pretty much SSL, permissions and getting the user data into one function (hence the $data = ...).

OK, thank you.