• Resolved SGURYGF

    (@sgurygf)


    Hi,

    So I have really-simple-ssl installed. My domain is abcd.com and I have content which links to my other domain abcd.com.au.

    So apparently the plugin replaces links to abcd.com.au with HTTPS which is wrong since my .com.au site is not running on SSL.

    Any ideas how to fix this?

    Thank you!

    • This topic was modified 7 years, 9 months ago by SGURYGF.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    If you have images on the other domain, and this domain does not have SSL, you will get mixed content. That is not advisable: users will get security warnings, and Google might rank you lower for that. It is better to put an SSL certificate on the other domain. You can leave the website on http, but these resources can then load over https.

    If you are sure you want to exclude the url, you can use this article:
    https://really-simple-ssl.com/knowledge-base/exclude-url-mixed-content-fixer/

    But you will lose your green lock.

    Thread Starter SGURYGF

    (@sgurygf)

    Hi,

    Thanks for your prompt reply, however i am not referring to resources being loaded from another site but just links to that site..

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    The mixed content fixer is designed not to replace any external links. The code works as follwos:
    First, all src= attributes are replaced to https:
    src=’https://” becomes src=’https://

    Then, with a preg_replace, all url, link (stylesheets) meta properties, and form actions are replaced to https.

    '/url\([\'"]?\K(http:\/\/)(?=[^)]+)/i',
    '/<link .*?href=[\'"]\K(http:\/\/)(?=[^\'"]+)/i',
    '/<meta property="og:image" .*?content=[\'"]\K(http:\/\/)(?=[^\'"]+)/i',
    '/<form [^>]*?action=[\'"]\K(http:\/\/)(?=[^\'"]+)/i',

    So I can’t really see how this code could replace your normal url’s to https.

    Maybe if a <link html tag is not followed by a href attribute. Is that possible? A malformed html markup would seem the most probable cause, because it is not normal behaviour. I would get a lot of complaints if every url would replace to https.

    If it is the mixed content fixer, you can disable it in the settings. That way you can also make sure it’s the mixed content fixer. Please let me know if that’s the case, and if you see any <link tags without a href attribute.

    Thread Starter SGURYGF

    (@sgurygf)

    Disabling mixed_content_fixer solves the issue.

    The page has no <link> tag without href.

    The link that is being replaced is a simple <a href="https://www.abcd.com.au">

    Unless im mistaken, the problem is not in the code that you posted, but in the one above it:

       $search_array = apply_filters('rlrsssl_replace_url_args', $this->http_urls);
       $ssl_array = str_replace ( array("https://", "http:\/\/") , array("https://", "https:\/\/"), $search_array);
       //now replace these links
       $str = str_replace ($search_array , $ssl_array , $str);

    This replaces all URLs which start with the get_option(‘home’), from HTTP to HTTPS.

    As I already stated, my second domain does fall into that category since it starts with that.

    https://www.abcd.com <- Home
    https://www.abcd.com.au <- Second domain

    The script thinks its the same domain but its not.

    As a temporary (?) solution, I have added this after that code:

    $str = str_replace ("https://www.abcd.com.au" , "https://www.abcd.com.au" , $str);

    • This reply was modified 7 years, 9 months ago by SGURYGF.
    • This reply was modified 7 years, 9 months ago by SGURYGF.
    • This reply was modified 7 years, 9 months ago by SGURYGF.
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Hi, that explains it!

    For such cases, you can use a filter. In this filter you can replace back the urls you don’t want https, like you did in your code above. When you put that code in your theme’s functions.php, it will keep even when the plugin updates.

    See example here.
    https://really-simple-ssl.com/knowledge-base/exclude-url-mixed-content-fixer/

    I’ll have to think about this to see if there would be a more generic solution that could be incorporated in the plugin.

    Thread Starter SGURYGF

    (@sgurygf)

    Great, thanks ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Exclude URL from replacement – Wrong URL’ is closed to new replies.