WordPress.org

Forums

WordPress HTTPS (SSL)
[resolved] [Plugin: WordPress HTTPS] XML-Sitemap Generator hack (8 posts)

  1. Richard Vencu
    Member
    Posted 4 years ago #

    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
  2. Richard Vencu
    Member
    Posted 4 years ago #

    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

  3. Mvied
    Member
    Plugin Author

    Posted 4 years ago #

    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.

  4. Richard Vencu
    Member
    Posted 4 years ago #

    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.

  5. Mvied
    Member
    Plugin Author

    Posted 4 years ago #

    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.

  6. Richard Vencu
    Member
    Posted 4 years ago #

    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

  7. Mvied
    Member
    Plugin Author

    Posted 4 years ago #

    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

  8. Richard Vencu
    Member
    Posted 4 years ago #

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

    Great solution!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress HTTPS (SSL)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic