WordPress.org

Forums

[resolved] Media uploader - why force HTTP? (5 posts)

  1. zygmoont
    Member
    Posted 1 year ago #

    Hi guys,
    I just cannot understand it - why on earth is WP media uploader always uploading the images with HTTP protocol? It only causes problems. Why not use the universal "//", which causes the content to load within the currently used protocol? //myblog.com/wp-content/uploads/2014/01/pic.jpg instead of forced protocol http://myblog.com/wp-content/uploads/2014/01/pic.jpg

    Or another option - don't include the whole protocol and domain in the source address at all, just use the "/" in the beginning of source address and link it from the root directory. It would be /wp-content/uploads/2014/01/pic.jpg instead of the full http path.

    More and more sites are using SSL mainly because the big sites are now serving their content only through HTTPS protocol. The SSLs are getting cheaper and many sites are offering their website in both versions. WordPress limiting itself only to one specific protocol is a little problematic.

    Do you know any plugin that could modify the uploader output url? Or any hook I could use to simply string replace every http:// to //?

    P.S. I am not interested in modifying the website output (if is_ssl() -> replace http with https) - that's what I am doing right now. I am looking for a universal solution performed during uploading the picture, not displaying it.

    Cheers,
    Daniel

  2. You'll also need this: https://wordpress.org/plugins/protocol-relative-theme-assets/

    Many things will be set to the URL of your site, which actually is the real issue. WordPress only does ONE base URL at a time. You're https or not, never both, so in so far as it cares.... It's not needed.

    The plugin answer is I believe you'd need to fork this - http://wordpress.org/plugins/relative-image-urls/ - and have it replace instead of remove.

  3. zygmoont
    Member
    Posted 1 year ago #

    Thank you, the Relative Image URLs plugin should do it. Or maybe I will just stay with converting src="http:// to src="https:// on if is_ssl() on the post output. Anyway, I am surprised that so few people have problem with https mixed content, based on the number of threads on the internet and the popularity of this kind of plugins, which is minimal.

  4. Well most of us just use https all the time, or not. And if you set WP up to be https from the get go, it's pretty much all just fine.

  5. mountainguy2
    Member
    Posted 1 year ago #

    zygmoont, I'm with you, truly weird that the image uploader doesn't just do the // prefix. Due to Google adding SSL-or-not to their algo just a few days ago, I just converted a huge content site over to https. Due to the lame image uploader, I now have to use a plugin search-replace to get shed of all those http prefixes or else I don't get the mythical green padlock. And typical of the WordPress scene these days, it took me three hours of activating and testing to find a search/replace plugin that actually worked with latest version of WordPress. It's all a big mess, I'm not impressed. MTN

Topic Closed

This topic has been closed to new replies.

About this Topic