WordPress.org

Ready to get started?Download WordPress

Forums

http and https (5 posts)

  1. Anonymous
    Unregistered
    Posted 10 years ago #

    hi there
    i am really pissed by a simple problem: i can't have both http://somesite/weblog and https://somesite/weblog working - the first problem is with the cookies (w/o correcting them you even can't use https!) the second is simple - you can not use in options only somesite.weblog you must use http:// or https://
    wwell edi

  2. OperaManiac
    Member
    Posted 10 years ago #

    my host has different folders for http and https! i am not sure how to make them work together either. :)

  3. Anonymous
    Unregistered
    Posted 10 years ago #

    To give more detail, the fix for cookies so that logins work for an https:// site is:
    Change the following line in wp-includes/vars.php from:

    define('COOKIEPATH', preg_replace('|http://[^/]+|i', '', get_settings('home') . '/' ) );

    To:

    define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('home') . '/' ) );

    (from mcnicold)

  4. heromyth
    Member
    Posted 9 years ago #

    I have found that to do belown in file wp_login.php can solve my problem .
    Change this:
    if ( dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) != get_settings('siteurl') )
    update_option('siteurl', dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) );
    to that:
    if(isset($_SERVER['HTTPS']))
    $server_protol="https://";
    else
    $server_protol="http://";
    if ( dirname($server_protol . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']) != get_settings('siteurl') )
    update_option('siteurl', $server_protol . $_SERVER['HTTP_HOST'] . dirname( $_SERVER['SCRIPT_NAME']) );

  5. Anonymous
    Unregistered
    Posted 9 years ago #

    thanks a lot, it works !

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.