Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:58:03+00:00 2026-06-08T04:58:03+00:00

Form this question ( ETag vs Header Expires ) i understood that i need

  • 0

Form this question ( ETag vs Header Expires ) i understood that i need both Expire headers and eTag headers because they serve two different purpose. Since i’m working on a WordPress plugin i don’t know how the server will be configured and so i was wondering how to check if eTags are on.
I could do

header( 'Content-Type: text/css' );

// Aggressive caching to save future requests from the same client.
$etag = '"' . md5( __FILE__ . $_GET['my-css-var'] ) . '"';

header( 'ETag: ' . $etag );
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 31536000 ) . ' GMT' );
header( 'Cache-Control: public, max-age=31536000' );

if ( empty( $_SERVER['HTTP_IF_NONE_MATCH'] ) || $etag != stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) {
// return the CSS
} else {
    // Not modified!
    status_header( 304 );
}

this would work both with Etag off and Etag on or would cause some errors if ETag are off?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:58:05+00:00Added an answer on June 8, 2026 at 4:58 am

    The web server does not need to have Etag handling turned on for your custom header to work. It will still be sent to the client.

    If your server has Etags turned off, the web server will not generate Etags for static files, i.e .jpg, .css, .js.

    In Apache you can unset Etags with the following config:

    <IfModule mod_headers.c>
      Header unset ETag
    </IfModule>
    
    FileETag None
    

    Since this is specific for Apache, and other web servers have different syntax, its a hard thing to check for in your script. But if it is set, it will remove your custom set Etag.

    This is not default in Apache though.

    To answer your question, no you cant check if Etags is on. But for your purpose I would not worry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is a simple question. I have a form that is being validated using
This is probably a basic html/css question... I have a simple one-button form that
In this question: If a form field has multi validators, how to let play
This question involves 3 tables and 1 form in my Access database. The tables
In this question I asked how to POST to a php file form a
I have this question relating to Lucene. I have a form and I get
Referring to this question: https://stackoverflow.com/questions/2035449/why-is-oop-hard-for-me class Form { protected $inputs = array(); public function
I have this quick question, i have got the username variable from a form
I have this kind of question. In my form, i got this as a
I have a follow-up question to this one . I created a new form,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.