Support » Plugins » image source url problem – absolute to relative

  • Hi all,

    I have a WordPress site (hosted in IIS7) where all the images have an absolute url as source (in both the theme and in the content).

    Unfortunately this becomes a problem when the site is viewed over SSL/HTTPS. In IE, we get the Secure/Non Secure pop up and in all browser we don’t get the reassuring lock in the address bar.

    Is there an easy way to change all the urls used to either: be relative or use the right protocol (ie. change http to https).

    Any help will be truly appreciated, whether it’s a hack, an existing plugin or pointers on what to exploit when writing a plugin to solve this issue…



Viewing 1 replies (of 1 total)
  • Hi all,

    I have found a simple solution to this…

    I created a simple plugin:

    /* Plugin Name: Content over SSL
    * Description: Swap to https if required
    * Author: Leo Seccia
    * Version: 1.0  */  
    add_filter('the_content', 'my_ssl');
    function my_ssl($content)
      return (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? ereg_replace("http://" . $_SERVER["SERVER_NAME"], "https://" . $_SERVER["SERVER_NAME"], $content) : $content;

    and then I also updated my wp-config.php:
    define('FORCE_SSL_ADMIN', true);

    All the best,


Viewing 1 replies (of 1 total)
  • The topic ‘image source url problem – absolute to relative’ is closed to new replies.