The page isn't redirecting properly, new hosting


I'm fairly new to Elgg and have adopted a website with it attached. I have set the website up on a server running red hat and am having some issues getting the elgg section of the website to run. Here's how it goes; the user logs into the front end of the website and when they go to elgg the website auto logs them in and tries to show the forum.

Next thing that happens is firefox gives me that redirect error. I checked what is going on and it is tossing between "social/" and "social/pg/dashboard/".

My .htaccess file is simply the dist version with the correct RewriteBase as my elgg setup is in a subdirectory. I have made sure the mod_rewrite is working by using the test supplied in the elgg guide and the global variables is off in the php.ini.

I have spent quite some time debugging through the various parts of the login process and it all just seems a tad strange! I tested the "isLoggedIn()" and "gatekeeper()" function in the sessions.php with the following debugs:

function isloggedin() {
            if (!is_installed()) return false;
            echo "<br/>installed, ";
            $user = get_loggedin_user();
            echo "<br/>is user set? : " . isset($user);
            if ((isset($user)) && ($user->guid > 0))
                echo "<br/>yes, with guid : " . $user->guid;
                return true;
            echo "<br/>no, returning false";           
            return false;


function gatekeeper() {
            echo "calling gatekeeper";
            if (!isloggedin()) {
                echo "not logged in";
                $_SESSION['last_forward_from'] = current_page_url();
                //forward(); //Comment out to test

and here is what the output gave:

is user set? : 1
no, returning false
.....[Above x 6]......
is user set? : 1
yes, with guid : 10261
.......[Above x 38]......
is user set? : 1
yes, with guid : 10261calling gatekeeper
is user set? : 1
no, returning falsenot logged in

There are no errors in either the apache log or the elgg logs that I can see to help with this matter.

I've been trying all sorts to get to the bottom of this, can anyone shed any light on where I might be going wrong?