Whole page expire headers not just elements

Discussion in 'HTML & Website Design' started by postcd, Dec 1, 2014.

  1. #1
    Hi,

    i have vbulletin and phpbb forum (an content management system). It is php based.

    I want to ask how to achieve whole pages have expire headers, not just elements like images, css, js have last-modiffy / expire information.

    I would like whole page have this so it is not redownloaded by web browser. Did not found any plugin for my cms, so my question is rather generally targetted on .php pages

    Thank You
     
    postcd, Dec 1, 2014 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    I would be EXTREMELY hesitant to do that, particularly on a forum where the content of pages changes a lot -- NO, I mean a LOT. Someone makes a new post, how is anyone going to get it without mashing F5 to force a reload?

    That said... if you REALLY want screw over your forums to the point they'd be crippled, you would use PHP's "header" function to set the expires header.

    header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31557600));

    Would set it to expire in a year... there's actually no such thing as "never", but a year is likely overkill and for something like a forums would STILL be a complete and utter screwup.

    Might I ask WHY you want to do this?
     
    deathshadow, Dec 1, 2014 IP
  3. postcd

    postcd Well-Known Member

    Messages:
    1,043
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #3
    thats a good point. in this case i guess there is no other easy way to achieve changing Last-modiffied/expires time once new reply/new topic is posted than using some content management system module?.. HTTP response headers then sends last. mod. date to the browser and browser redownload page if date is newer than cached version.

    Thank You, this is interesting code, but as U say, it can cause issues on forum (repeated visitor not seeing newly added replies or login form issue maybe.. etc)
     
    postcd, Dec 1, 2014 IP