what is If-Modified-Since HTTP header?
you don’t need to worry about this unless you have thousand of webpages and updates daily.
How add If-Modified-Since HTTP header through php
By Default will be added by server configuration . if not you can try below php method.
you can do this by adding below code
header("Last-Modified: " . the_modified_date());to wp-config.php at the end of it before ?>.
or before /* That’s all, stop editing! Happy blogging. */
This also not working as error says “Fatal error: Call to undefined function the_modified_date() “
Add If modified last modified using plugins ft w3 total cache.
Adds the ETag, Last-Modified, Expires and Cache-Control headers to HTTP responses generated by WordPress to facilitate caching.
this plugin working to enable if modified since for WordPress
Adds post last modified to HTTP header to enable squid or cdn to cache your wordpress web page. Squid will not cache the page without http header field.
it works on posts only not for the homepage.
4. If Modified Since HTTP Header
A simple plugin to sent “304 If Modified Since HTTP Header” to the web crawlers, so that they only fetch your site when something updated.
("Last-Modified: " . the_modified_date());
also follow this thread on stackoverflow.
Enabling If-Modified-Since HTTP header by .htaccess Apache server
# enable expirations
# expire GIF images after a month in the client’s cache
ExpiresByType image/gif A2592000
# HTML documents are good for a week from the
# time they were changed
ExpiresByType text/html M604800
Enable if modified since on nginx seer
by defaults its off
context location http, server or location block.
for static files series from local disk it reruns etag last modified and if modified since.
but other content like dynamically generate html in wordpress through fastcgi it should be sep
proxy header or when using nginx as reverse proxy for apache.
add_header if_modifeid_since $upstream_status.
Why if modified since important for SEO?
this header popular when google suggests and the feedthebot website recommended it. but how its useful.
it only stops from googlebot crawling & fetching unnecessarily. like browser before downloading a file it checks through etags
then server returns with 304-not modified, then googlebot ok then it’s not necessary download the page for caching purpose.
where to check If-Modified-Since HTTP header supports or not?
304 & GZIP browser returning 304 after gzip off
if-modified-since = last-modified (the file has never been changed)
if-none-match = Etag (again, the files has never been changed)
304, or 200 OK,
gzip & Etag:
gzip off 304
gzip on etag off 304
gzip & etag on; 200
mod_deflate it’s as simple as adding the encoding to the already computed ETag.