Tuesday, March 30, 2010

Joomla Administrator force SSL login loop FIX

It took me A LONG time to find a solution on how to fix this problem. All credit for this fix goes to member:jptkts from http://forum.joomla.org.

This fixes the login loop issue when trying to login to the admin after making the Force_SSL to 1 or Administrator.

His original forum post is
http://forum.joomla.org/viewtopic.php?p=1619969#p1619969

I just wanted to re-post it in an easy to find place!

In the file: Joomlaroot/libraries/joomla/environment/uri.php
starting on line 214 replace this if statement:
Code:
if(JPATH_BASE == JPATH_ADMINISTRATOR) {
   $base['path'] .= '/administrator';
}

with the following:
Code:
if(JPATH_BASE == JPATH_ADMINISTRATOR) {
   $force_ssl = $config->getValue('config.force_ssl');
   if($force_ssl > 0){
      $base['prefix'] = ereg_replace("http://","https://",$base['prefix']);
   }
   $base['path'] .= '/administrator';
}


Stumble Upon CodePyro

3 comments:

Anonymous said...

THANK YOU! I WAS RIPPING OUT MY HAIR!

To clarify this issue for anyone who may need clarification - this issue arises when force ssl is set for admin only and $live_site (in configuration.php) is a non-https url. Note, if you don't have extensions installed which are making inappropriate use the $live_site variable, a better fix is to just set $live_site as an empty string and avoid making the core hack required. Unfortunately, several extension developers (some SEF components, for example) make liberal inappropriate use of the variable.

Ps. Its slightly more efficient and accomplishes the same thing to use str_replace rather than ereg_replace. Also, if you needed the regex functionality, you should use preg_replace as ereg_replace is deprecated.

THANK YOUR FOR POSTING THIS!!!

Anonymous said...

THANK YOU FOR POSTING! Finally a solution that works! Great job! Thanks again:-)

Anonymous said...

Thanks for posting that! Solved my problem neatly.

Jim

Post a Comment