WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WordPress HTTPS] XML-Sitemap Generator hack

[Resolved] [Plugin: WordPress HTTPS] XML-Sitemap Generator hack

  • Hi, In order to generare a good XML sitemap using XML-Sitemap Generator in conjunction with this plugin I hacked the sitemap-core.php and injected this code starting line 1850 by replacing

    $GLOBALS['post'] = &$post;
    $permalink = get_permalink($post->ID);

    with

    $GLOBALS['post'] = &$post;
    $permalink = get_permalink($post->ID);
    
    //check for force_ssl custom field - hack
    $force_ssl  = get_post_meta($post->ID, 'force_ssl');
    // Is it empty?
    if($force_ssl) {
    $permalink = str_replace('http:', 'https:', $permalink);
    }
    else {
    $permalink = str_replace('https:', 'http:', $permalink);
    }
    //end of hack
Viewing 7 replies - 1 through 7 (of 7 total)
  • I would like to see a similar thing in the WP custom menus I am using so there would be no more redirects from http to https into those pages

    Plugin Author Mike Ems

    @mvied

    You should be able to accomplish this with the ‘Disable Automatic HTTPS’ setting in WordPress HTTPS. I know it works on custom menus, so I’m assuming you don’t have that option on.

    Let me know if that fixes it for you.

    Yes, it works as intended. However what I wanted to say is that I need menus to point me to a mixed load of http and https links. Now they all point to the http then the http page loads, then it is redirected to https page.

    If the server is severely loaded then the redirect is taking few seconds and the final page is displayed very slow. Therefore I thought maybe there is a way to construct the menu directly with proper http and https links according to the force_ssl custom field.

    Plugin Author Mike Ems

    @mvied

    Ah, I see what you mean. That would be ideal, but not as simple as it sounds. 🙂

    This is definitely something I want to add to the plugin at some point, but I can’t see me fitting it in there any time soon.

    It is worth noting that HTTPS is significantly slower than HTTP due to encryption and such, and that may be what you’re experiencing.

    True, however I am looking at Chrome Developer Tools in Resource Section, Time and I can see:
    – load of HTTP page and decision to redirect – 1.02s
    – load of HTTPS page (from cache – is true) – 65ms
    – load of other elements – 0.25s
    – DOMContent event fired – 1.36s
    – Load event fired – 1.48s

    So when the cache is involved, the redirection takes most of the time. At this speed there is no problem but if the reader is across continents the latency will just double and the page tends to become very slow.

    If I get any idea how to do it I will let you know.

    Cheers

    Plugin Author Mike Ems

    @mvied

    Hey rvencu,

    I just wanted to let you know that I’ve figured out a relatively easy way to avoid all the redirections. I’ll get it into the next version, which I should be able to push out before this weekend.

    Thanks,
    Mike

    Hi @mvied, I updated the plugin and it is working very well. If I catch any error I will notify you ASAP.

    Great solution!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] [Plugin: WordPress HTTPS] XML-Sitemap Generator hack’ is closed to new replies.