Unable to set http links to non SSL Sites

Home Forums General issues Unable to set http links to non SSL Sites

This topic contains 16 replies, has 3 voices, and was last updated by  Rogier Lankhorst 2 months, 1 week ago.

Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #13732 Reply

    Roy Randolph
    Participant

    I have inquired about this before, and never really found a solid solution. The problem I am having is when I try to place a http://some-URL.com and when I save, the URL is changed to https://some-URL.com

    The simple solution would simple be to make the http://some-URL.com to https, but if you do not own the site or if you have special content that needs to be delivered via http changing to https isn’t a solution.

    A while back I did communicate with Rogier with this issue, and its been a while, and I was trying to use the same domain in the http url I was using. The solution he passed over to me didn’t seem to work.

    My understanding the plugin is suppose to rewrite only links with same domain. But in the latest try I am using a different domain. And still my URL is getting written back to https and the page load fails.

    So, is there a solution that I can try to make sure I can link to outside URLs using http instead of https?

    Thanks

    Roy

    #13733 Reply

    Hi Roy,

    I guess that would have been the filter on the mixed content fixer.

    The mixed content fixer does not only replace the urls from one’s own domain, but replaces urls from all domains that are used as a resource in the site. If it wouldn’t do that, you would get mixed content.

    So for your situation, there are two options: use the filter, which is a tested solution, or disable the mixed content fixer.

    The filter (which I think you have tried, but maybe didn’t implement the right way)
    Please note that the first domain is the https domain, the second one the http domain.
    Place this code in your theme’s functions.php.

    function rsssl_exclude_http_url($html) {
      $html = str_replace("https://www.domain.com", "http://www.domain.com", $html);
      return $html;
    }
    add_filter("rsssl_fixer_output","rsssl_exclude_http_url");
    #13734 Reply

    Roy Randolph
    Participant

    Hi Rogier

    Yes, sir you are correct, and I do have the code you submitted above installed in functions.php. It doesn’t seem to be working.

    I am wondering if operating on a Nginx environment instead of Apache environment would be causing this to happen in someway?

    Roy

    #13735 Reply

    That doesn’t matter, it’s purely a php function.

    If you enable errorlogging, by adding to your wp-config.php

     define('WP_DEBUG', true);
     define('WP_DEBUG_LOG',     true);

    Then add error_log(“executing mixed content filter”); in the function, you could check if the function gets executed at all. You can find the debug_log in the wp_content folder.

    #13754 Reply

    Roy Randolph
    Participant

    Hey Rogier

    As a follow up, for some reason the code started working. Strange thing is, there is nothing I did differently.
    When I pulled up the header.php file and looking for the link, it was showing http. YA!

    All I have done is removed and replaced (actually have done this several times) and this time it took.
    Then I had another issue, while the code was showing http:// as it should, when I loaded my page, still getting https, so like I always tell other people, clear your browser cache, I did take my own advice. Didn’t help.
    Tried other browsers with clean browser cache, still same issue. Also have been clearing the Varnish Cache on the server as well along with the Memcached Cache. None of that had an affect, still showing https.

    To make a long story short the Memcached Cache / Varnish Cache wasn’t clearing on the server, giving me these latest issues, and wondering now if it wasn’t the problem all along.

    Hope my tribulations helps some one else.

    And thanks for your help

    Roy

    #13755 Reply

    Thanks for the update!

    #20505 Reply

    Claire

    Hi Rogier,

    I’m having a very similar problem to Roy, but it appears only some links (the first links) on my blog posts aren’t working. If I add the same link later on a page, it processes ok.

    Please see this page for an example: The image link won’t work; the text link alongside does. Is this the plugin? Can I fix it?

    Thanks for your help (and for your plugin, which I’ve found excellent)

    Claire

    #20506 Reply

    Hi Claire, it seems the link to your page has gone missing. Can you post it again?

    What my plugin does, is converting all internal links to https, which is what you want. Also, images, and javascript and css files and such will be converted to https. External links are left alone, as these can lead to other domains.

    Can you give an specific example the issue? If you can post the page, I can see for myself what the problem is.

    #20510 Reply

    Claire

    Thanks Rogier for the explanation – and sorry I forgot to include the link to my page. Something seems to be trying to convert the first links in a page to https – I don’t know what it is though!

    https://english-wedding.com/the-directory-calligraphy/

    Maybe this will make it clearer?

    #20518 Reply

    I see what you mean. Is it https in the html in the WordPress editor, or does it get that way when outputted to the front-end?

    Assuming it is http in the back-end, and converted on the front-end:
    I don’t think it’s my plugin that is doing this, but it’s easy to test. You can disable the mixed content fixer in settings/ssl/settings. Then clear cache and browser cache, and check this page. Your site will stay on SSL, but my plugin does not actively do anything on the front-end anymore. If the link is still https, something else is doing this.

    #20525 Reply

    Claire

    Thanks Rogier,

    Disabling the mixed content fixer and clearing my cache has fixed the problem, thank you.

    However – I now have mixed content on my site, I guess. If there’s anything you can suggest to fix the problem so I can re-check that box to fix the mixed content without affecting external hyperlinks I’d be very grateful!

    Thank you again for your help

    Claire

    #20526 Reply

    Claire

    Hi Rogier – just another quick note: I think this has only happened since the latest version of your plugin was released? (I updated this morning).

    Thanks again,

    Claire

    #20529 Reply

    Good to know where it is coming from. The strange thing is, I did not actually change the mixed content fixer, only the point on which it hooks into the WordPress code. The plugin replaces exact matches of your home_url to https, as well as all urls that start with src=”http://, thus fixing images, javascript libraries etc. And finally, some patterns are applied, that check for forms, meta tags, etc. These do not apply to this html.

    I took your code, and put it in a test page of mine, and it didn’t convert that link to https. So there must be something in your site specifically that cause my code to do the wrong thing.

    If wonder if you could do a little test for me? If you have FTP access to your site, could you go to wp-content/plugins/really-simple-ssl/class-mixed-content-fixer.php, lookup line 104, and comment it out? So it looks like this:
    //$str = str_replace ($search_array , $ssl_array , $str);

    Then enable the mixed content fixer, and see if the issue comes back?

    That would give me some info about what is going on here. Afterwards, remove the // again and it will work as before.

    Now, as to a solution for you, the following code will replace the link back to http:

    You can add this to your functions.php in your theme:

    function rsssl_exclude_http_url($html) {
      $html = str_replace("https://calligraphy-for-weddings.com", "http://calligraphy-for-weddings.com", $html);
      return $html;
    }
    add_filter("rsssl_fixer_output","rsssl_exclude_http_url");
    #20530 Reply

    Claire

    Hi Rogier,

    Commenting out that line of code seems to have worked. I’ve done that, re-checked the mixed content fixer, and all seemed fine.

    Thanks for giving me the code to add to my functions.php file. I’ll add that now and hopefully won’t bother you again!

    I really appreciate your help. Thank you.

    Claire

    #20537 Reply

    Claire

    Hi Rogier,

    I spoke too soon! I’m still struggling with occasional external hyperlinks. I’ve no idea why.

    Turning off the ‘mixed content fixer’ does work.

    If you discover anything I’d be really grateful to know if there’s another solution.

    Thank you for your help.

    Claire

    #20582 Reply

    And commenting out that line with the mixed content fixer enabled fixes the issue? If not, can you show me another example?

    I’ll have to investigate this. It’s almost as if the home URL doesn’t get passed or something like that.

    #20605 Reply

    It’s a bit hard as I can’t reproduce it. I might need to get some PHP debugreports from your site, I’ll get back to you in a few hours, with some instructions how to go about that, if you are willing to work with me on this of course 🙂

Viewing 17 posts - 1 through 17 (of 17 total)
Reply To: Unable to set http links to non SSL Sites
Your information: