Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm not sure if this is better in this forum or in the Server Fault forum...

On Google Webmaster Guidelines I see this:

"Make sure your web server supports the If-Modified-Since HTTP header. This feature allows your web server to tell Google whether your content has changed since we last crawled your site. Supporting this feature saves you bandwidth and overhead."

(at this link: http://www.google.com/support/webmasters/bin/answer.py?answer=35769#1 )

I contacted Godaddy and they told me:

"I understand you would like to know if your server currently has the "If-Modified-Since HTTP header" installed. I used an external tool to test this and found that it is not currently being utilized by your server. Additionally I was unable to find a reliable source to get specific requirements on what this server needs to function. In order to determine if your server supports this you will need to provide us the exact specifications required to run it."

How do I ensure the If-Modified-Since HTTP header is supported and that it is active?

Thanks

share|improve this question
    
What sort of hosting are you on with Godaddy? Shared, VPS, dedicated server? –  paulmorriss Sep 5 '11 at 9:10
add comment

2 Answers

This If-Modified-Since header is sent by client and not server: Server just has to respond accordingly. This request header "Allows a 304 Not Modified to be returned if content is unchanged"

A conditional GET method requests that the identified resource be transferred only if it has been modified since the date given by the If-Modified-Since header. The algorithm for determining this includes the following cases:

  • If the request would normally result in anything other than a 200 (ok) status, or if the passed If-Modified-Since date is invalid, the response is exactly the same as for a normal GET. A date which is later than the server's current time is invalid.

  • If the resource has been modified since the If-Modified-Since date, the response is exactly the same as for a normal GET.

  • If the resource has not been modified since a valid If-Modified-Since date, the server shall return a 304 (not modified) response.

The purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction overhead.

It worth mentioning that wit ill automatically work for static files only (as such files are server directly by web server (Apache/IIS/etc) and it can detect the changes. For dynamically produced pages (by PHP/ASP.NET etc), you will need to implement your own logic inside the code that generates that page if you want to handle such request header efficiently.

You will not see this implemented for dynamically generated pages very often, unless you have very good full-page caching system in place -- either by Framework you use, by web server (IIS can do this) or maybe your proxy (like Varnish, for example).

Both Apache and Microsoft IIS do support these request headers (as they are that are used by GoDaddy on Shared Hosting plans).

Here is one tool (untested by me) that can check if your website supports this header. Obviously, the result will depend on what resource you will request (static file or dynamically generated page):

share|improve this answer
add comment

If you're running Apache, you need the mod_expires and mod_headers modules to be installed and enabled. Your web host may need to recompile Apache to include them if they're not installed.

With mod_expires and mod_headers active, you can send and control the Last-Modified header by editing your .htaccess file to include:

# Expire all files one week after they're accessed 
ExpiresActive On 
ExpiresDefault "access plus 1 week" 

More information and settings available from the Apache mod_expires documentation.

By serving content with a Last-Modified header, your site will now support requests from clients that use If-Modified-Since headers.

share|improve this answer
    
mod_expires controls the Expires header, which is unrelated to If-Modified-Since. The latter is enabled by default on Apache. –  Tim Fountain Sep 5 '11 at 10:29
    
@Tim I was under the impression that mod_expires allows you to send a "Last-Modified" header (edited my answer to clarify this), which is required for Google to be able to make requests using an "If-Modified-Since" header. Source: Apache caching guide. –  Nick Sep 5 '11 at 11:46
    
Apache will send Last-Modified headers by default for static assets. mod_expires is for controlling the Expires header only, unless it has some other functionality I don't know about. The page you linked doesn't seem to indicate this though. –  Tim Fountain Sep 5 '11 at 14:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.