How To: Find yourself randomly logged out? (Windows Server) (1 post)

  1. Ganners
    Posted 4 years ago #

    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).

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

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by Ganners
  • This topic is not a support question
  • WordPress version: 3.0.1


No tags yet.