WordPress.org

Ready to get started?Download WordPress

Forums

Getting cookies to work with https (5 posts)

  1. mcnicold
    Member
    Posted 10 years ago #

    Hi there,
    I have been attempting to install WordPress on our departmental intranet at work, which uses secure HTTP. In order to get this to work, I had to 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') . '/' ) );

    I am not too sure about how everything works in WordPress yet, but I guess this search-and-replace was failing because the cookie path wasn't matching the URL. The additional s? after the http seems to fix this.
    D

  2. Anonymous
    Unregistered
    Posted 10 years ago #

    This is one of two changes we had to make to get it to work for a https:// site. The other was to give the url in the options screen as https://site.hostname.com/ instead of just site.hostname.com.

  3. Anonymous
    Unregistered
    Posted 9 years ago #

    Okay, I'm having a problem. I've tried using this and the tips on http://wordpress.org/support/3/7091 but nothing works. I could log in just fine when I was at home, but I just moved into my college Tuesday and I haven't been able to. Help!

  4. Anonymous
    Unregistered
    Posted 9 years ago #

    Bump.

  5. Anonymous
    Unregistered
    Posted 9 years ago #

    I also had to make this change to stop the login page from redirecting me to http://sitename instead of https://sitename during the login:
    diff -Naur /tmp/wordpress/wp-login.php wordpress/wp-login.php
    --- /tmp/wordpress/wp-login.php 2004-10-05 17:34:30.000000000 -0700
    +++ wordpress/wp-login.php 2004-10-13 17:40:46.000000000 -0700
    @@ -74,8 +74,8 @@
    }
    $error = '';
    // If someone has moved WordPress let's try to detect it
    -if ( dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) != get_settings('siteurl') )
    - update_option('siteurl', dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) );
    +if ( dirname('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) != get_settings('siteurl') )
    + update_option('siteurl', dirname('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) );
    switch($action) {

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.