• This error has been popping up a lot recently with people who have shared hosting on windows.

    The problem is, which they tend not to realise, is that if they log in with “www” in the URI, then return to that site without including that “www” they will find themselves logged out. With often no mod_rewrite to work for you the simple answer is a header redirect to include it.

    If using wordpress, you insert this code at the very top of your header.php on your theme it will do the job for you. (if you insert after the wp_head(); then conflicts can occur).

    <?php
    
    $url = $_SERVER['HTTP_HOST'];
    $request = $_SERVER['REQUEST_URI'];
    $search = "www";
       if (strstr($url, $search) == FALSE)
       {
          $redirectTo = "http://www.". $url. $request;
          header( 'Location:'. $redirectTo ) ;
       }
    ?>

  • The topic ‘How To: Find yourself randomly logged out? (Windows Server)’ is closed to new replies.