• hello.

    is there any way of setting up a wordpress install (2.0) making it possible to access the site via a http AND a https vhost.

    maybe it is a fault or misunderstanding the installatioan procedure, but if i access an installed site via https all links are still pointing to http and images seem to be included with full http-path as well. is there a way/hack whatever to use only relative URLs so it works?

    i do not mean the ssl hack for the admin area, i mean simply accessing the site.

    thx,
    startx.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, there’s:

    https://www.almosteffortless.com/wordpress/force-ssl/

    which comes close to what you’re asking for. I’ve been plugging away at a method of forcing WordPress to use relative links (for such things as this), but hit a number of roadblocks. Let’s just say WordPress is pretty demanding for “absolute” control on this issue.

    Thread Starter startx

    (@startx)

    i cannot believe that wordpress is totally bound to full path URLs. is there any reason for that?

    I’m not sure why WordPress uses absolute URLs, but the plugin I made (linked above) would FORCE a client to connect via https. If you have an SSL certificate, you already have a site that allows http AND https connections. Right?

    Thread Starter startx

    (@startx)

    hi trevorturk.

    sure the plugin works, but i actually dont want to use “force https” because i guess its quite confusing to users. i was hoping for a more “basic” solution to the problem.

    i found somewhere that http/https was allready on the wishlist for 1.6 but it seems it was never worked on that.
    correct me if im wrong.

    I have do some “ugly” modified in the file “wp-includes\function.php”.
    I have changed the get_settings function to the following(I have mark with the comment ‘//——HERE IS THE CODE I HAVE CHANGED START——–‘ line), and seem is what you need, hope this can help!

    function get_settings($setting) {
    global $wpdb;

    $value = wp_cache_get($setting, ‘options’);

    if ( false === $value ) {
    if ( defined(‘WP_INSTALLING’) )
    $wpdb->hide_errors();
    $row = $wpdb->get_row(“SELECT option_value FROM $wpdb->options WHERE option_name = ‘$setting’ LIMIT 1”);
    if ( defined(‘WP_INSTALLING’) )
    $wpdb->show_errors();

    if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
    $value = $row->option_value;
    wp_cache_set($setting, $value, ‘options’);
    } else {
    return false;
    }
    }

    // If home is not set use siteurl.
    if ( ‘home’ == $setting && ” == $value )
    return get_settings(‘siteurl’);

    //——HERE IS THE CODE I HAVE CHANGED START——–

    if ( ‘siteurl’ == $setting || ‘home’ == $setting || ‘category_base’ == $setting ){
    $value = preg_replace(‘|/+$|’, ”, $value);

    if($_SERVER[“HTTPS”] == “on”) {
    $value = preg_replace(‘|https://|’, ‘https://’, $value);
    }
    }
    //——HERE IS THE CODE I HAVE CHANGED END——–

    return apply_filters( ‘option_’ . $setting, maybe_unserialize($value) );
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘get wordpress running on both https / http’ is closed to new replies.