• Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / apache server tutorial (install,config, performance tuning, security, error handling) / what is If-Modified-Since HTTP header how to add to WordPress website

what is If-Modified-Since HTTP header how to add to WordPress website

Table of Contents

Toggle
  • what is If-Modified-Since HTTP header?
  •  How add If-Modified-Since HTTP header through php
  • Add If modified last modified using plugins ft w3 total cache.
  • Enabling  If-Modified-Since HTTP header by .htaccess  Apache server
  • Enable if modified since on nginx seer
  • Why if modified since important for SEO?
    • where to check If-Modified-Since HTTP header supports or not?
  • 304 & GZIP browser returning 304 after gzip off

what is If-Modified-Since HTTP header?

it’s HTTP header request to google bot. if your server support
If-Modified-Since HTTP header it’s shows last modified content to Google bot. and googlebot can download this and quick index your website get in search results very quickly.
blogger platform supports this. some of web hosting companies may not supports. if your website not support HTTP header modified since then ask your web host providers.
when you choosing a right web host company worth to ask If-Modified-Since HTTP header supports or not.
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.

Just Install w3 total cache plugin, if you are in managed WordPress hosting, you have to look for alternatives.

1.Add Headers
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

https://wordpress.org/plugins/header-last-modified/
2.  Last Modified

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.

3. I prefer second plugin because 1st plugin have more functions may be it can vulnerability with w3 total cache plugin .

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.

https://wordpress.org/plugins/if-modified-since-header/
NOT WORKING on the home page.
also try edit wp-config.php
add below code at the end config php before it closes before ?>
("Last-Modified: " . the_modified_date());

also follow this thread on stackoverflow.

Enabling  If-Modified-Since HTTP header by .htaccess  Apache server

 

# enable expirations
ExpiresActive On
# 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

if_modifeid_since exact;

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.

we can

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?

curl with request headers
step 1
curl online tool
curl -I https://rajuginni.com/files.css  (html/js etc)
ETag: “57d40685-400”
step 2:
curl -I -H ‘If-None-Match: “57d40685-400″‘ http://localhost/test.html
curl -I -H “If-Modified-Since: Wed, 29 Nov 2017 14:27:08” https://example.com
also here
check here google webmasters guidelines.pdf

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.

Apache 2.5
DeflateAlterETag AddSuffix|NoChange|Remove

Content-Encoding: gzip
Transfer-Encoding: chunked
Vary: Accept-Encoding

Content-Length: 5292
Expires
Last-Modified

resources

https://discussion.dreamhost.com/thread-6497.html

http://webmasters.stackexchange.com/questions/19189/support-of-if-modified-since-http-header
https://support.google.com/webmasters/answer/35769#1

Ask a Question:

You must be logged in to post a comment.

apache server tutorial (install,config, performance tuning, security, error handling)

  • what is If-Modified-Since HTTP header how to add to Wordpress website
  • htaccess tutorial tips for wordpress #redirect #leverage browser cache #Gzip #KeepAlive
  • apache modules list (explained, enable disable)
  • connect to server by SSH client Putty SFTP client winscp LAMP, LEMP nginx apache etc linux
  • Lamp stack install on Ubuntu 20.4 LTS apache, mysql, php 7.4(Debian 9 & Ubuntu 18.04 lts)
  • apache performance tuning mpm-worker vs prefork vs event modules
  • enable caching in apache server (mod cache disk cache) vs fastcgi cache
  • how to enable KeepAlive connections in apache nginx wordpress
  • Cache control Header & expires headers How to set Properly
  • apache2 conf sample explained apache configuration file modules etc
  • restart apache in ubuntu (start | stop | reload | config test) centos debian mac linux windows 10 xampp
  • uninstall apache2 ubuntu in 3 steps Debian

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy