Really Simple SSL

How to exclude a url from the mixed content fixer

Rogier

Rogier

Share on facebook
Share on twitter
Share on linkedin

It sometimes is necessary to exclude a certain url from the mixed content fixer. For those who don’t know already: the mixed content fixer in Really Simple SSL changes all urls from http to https, except for hyperlinks to other domains.

This can be easily accomplished with a filter. You can add it to your functions.php. It will execute after the mixed content fixer has done its work, so you have to replace the urls back to http, like this.


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");

Related articles

26 Responses

    1. If you need to replace more than one url, you can just copy this line:
      $html = str_replace(“https://www.domain.com”, “http://www.domain.com”, $html);
      and repeat it as often as you need.

  1. Hi,

    at first – thank you for your Plugin. It works as it should.

    But the Problem with changing external Links to https is really a big Problem.
    We have a site with more than 16.000 Articles. We have Partnersites which are paying for the Linking.

    I´m not able to put every URL in the function our online Authors using in their Articles (about 7 to 10 a Day).

    So, could there be a solution, where the function checks if the link has a target=”_blank” or a rel=”nofollow” – and then – it will exclude them from changing?

    That would be amazing if this would work!!!

    Thanks for your Help!
    Martin

    1. Hi Martin,

      The mixed content fixer only replaces hyperlinks that point to your own domain, and does not replace external domains. It might replace it, if your own url is a part of the external url, for example: your domain: domain.com, and external domain: domain.com.au.

      In this case, the mixed content fixer will replace the domain.com, and as a result will also replace the external domain. Do you have an issue with external links over https, which stops when you disable the mixed content fixer?

      1. Hi Rogier,

        thanks for your reply. Didn´t get the notification 😉

        I disabled the mixed content fixer. In fact – I disabled all of the settings.
        It still messes with the external Links. Deleted the cache to be sure…
        After disabeling the fixer – one thing is working now – it does not change the hardcoded external javascript from an advertiser which is located in the header.php

        I used another plugin before (force ssl), which did the same thing.

        On these Screenshots you see what it is doing.

        Admin:
        http://i68.tinypic.com/30ieuqd.png

        When I hover on Frontend (Bottom left):
        http://i68.tinypic.com/2pz9q8l.jpg

        Thanks again for your help.
        Martin

        1. You can mail me the pictures at rogier (at) really-simple-ssl.com.

          If you still have the issue when the mixed content fixer is disabled, it’s not the plugin that’s doing it. Maybe you have another plugin that causes this?

        2. As for the plain text, the mixed content fixer will replace all strings of your own domain to https, so plain text as well. But only your own domain, not external domains. I have seen this once where a plugin changed all links to // when a website was on SSL, but I don’t know which plugin that was.

          1. Thanks a lot for your replies. Sorry that it took me so long to read them. I had the Plugin “WP Force SSL” installed. Don´t have it anymore. I also don´t see any other Code in the htaccess file – except yours. Is it possible that a Database Entry still exists, which does this re-writes? Or where do I have to look?

            Thanks again for your answers!

            Martin

        3. The change of the urls is completely dynamic, so will stop if you disable the mixed content fixer in the settings. No database or file changes are made.

          1. No, I´m not talking about your Plugin – I think yours is doing it right. I generally meant if it is possible that a Database entry could cause this situation? If you say “yes” – I would look into the database. If you say this is not possible it has to be in the htaccess or somewhere else, I would look there…

            Thanks!

          2. Strange… Nothing is installed which could do that…

            Many Thanks anyway for your time and Plugin!

            Martin

  2. Great plugin! but is there a way to exclude all iframe scr urls from being changed to https?
    i have some swf games embedded with iframe from non SSL sites and they dont work no more…

    1. You could use the code on this page to replace the string ‘iframe src=”https://’ to ‘iframe src=”http://’
      But that won’t help you: browsers will block http sources in an iframe on a https website, so the swf games will get blocked if you try to load them over http in a https website.

  3. Hi, thanks for your plugin and for workaround for mixed content, I used on a site where I embed a feed from an IP camera, before the workaround the IP cam wasn’t shown, now yes but Chrome makl the site as not fully protected and I lose the padlock icon.
    Any hint?
    Thanks,
    Andrea

    1. Hi Andrea, this workaround will exlude this url from the mixed content fixer. As a result the mixed content isn’t fixed anymore, so you’ll have mixed content. It’s better not to exclude anything from the mixed content fixer of course! The solution is to give the domain of the Cam an SSL certificate, or serve it from your own domain.

      1. Hi Rogier, thanks for your reply, unlucky the SSL certificate that the cam uses is a self certificate, so it’s useless. Now I’m trying to use some free proxy to show the cam, even if I don’t know how 🙂
        Best,
        Andrea

  4. I’m having a problem with an audio source. This audio doesn’t work with https and I tryed to exclude from Really simple SSL.
    This worked for some time but not anymore. The audio source is loaded some seconds after the web and still loads under https. I removed the mixed content solver but still doesn’t work.
    Any ideas or solution?
    Thanks

        1. Hi,

          the audio source is loaded from http://www.ondacampus.es:8000/ondacampus. It’s possible the server hosting the audio on port 8000 is configured to only work on SSL. You could try to update the server configuration to allow SSL connections as well. If you use a WordPress plugin to host the audio stream, you could have a look at the settings if there’s a setting to allow SSL connections.

          Mark

          1. I guess is something related to Chrome browser. When the website is https it forces in some way the audio to be loaded under https. With Firefox there is no problem.

Leave a Reply

Subscribe