[solved] HTTP/2 push for images - Wordpress and LSCache plugin activated

Discussion in 'General' started by JulienBayonne, May 27, 2018.

  1. JulienBayonne

    JulienBayonne Active Member

    Hello

    On my Vitadesign.ch Wordpress website I do some CSS and JS push through the LSCache plugin.

    Now I want to do it for images. so I tried the following for on image:
    Code:
    add_header link: "</wp-content/uploads/2018/05/farm-3358870_1920-d-lc-.jpg>; rel=preload";
    But it is not pushed accroding to http://http2-push.io/.

    Is there maybe another configuration to make on my websote so?

    Any help?

    Regards

    Julien
     
    Last edited by a moderator: May 30, 2018
  2. JulienBayonne

    JulienBayonne Active Member

    Ok I noticed that then
    Code:
    add_header link: "</wp-content/uploads/2018/05/farm-3358870_1920-d-lc-.jpg>; rel=preload";
    is visible on the website's display on top...


    I tried to add these <?php ?> brackets, but when updating they disappear from the editor...
     
    Last edited by a moderator: May 30, 2018
  3. Tishu

    Tishu Well-Known Member

    Hello,

    You can add this in to the header.php:
    PHP:
    <?php
      header
    ("Link: </path to the image>; rel=preload; as=image"false);
    ?>
     
    Last edited by a moderator: May 30, 2018
  4. JulienBayonne

    JulienBayonne Active Member

    Thanks. I just added it but it does not work, here the whole head code:
    PHP:
    <head>
    <?php astra_head_top(); ?>
    <meta charset="<?php bloginfo'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="http://gmpg.org/xfn/11">

    <?php astra_head_bottom(); ?>
    <?php wp_head
    (); ?>
    </head>
    <head>
    <?php astra_head_top(); ?>
    <meta charset="<?php bloginfo'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="http://gmpg.org/xfn/11">

    <?php astra_head_bottom(); ?>
    <?php wp_head
    (); ?>


    </head>

    <?php astra_head_top(); ?>
    <meta charset="<?php bloginfo'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="http://gmpg.org/xfn/11">

    <?php astra_head_bottom(); ?>
    <?php wp_head
    (); ?>

    <?php
    header
    ("Link: </wp-content/uploads/2018/05/farm-3358870_1920-d-lc-.jpg>; rel=preload; as=image"false);
    ?>

    </head>


    Regards
     
    Last edited by a moderator: May 30, 2018
  5. JulienBayonne

    JulienBayonne Active Member

    Just checked again, it works now :) Thanks
     

Share This Page