What I want to do is try to get search engines to rescan my sitemap files (plain xml files stored on server). It did recently attempt to access it but it received a not modified response (HTTP status 304) from the server.

Is there any configuration setting I can apply to apache so that any future requests to successful xml files return HTTP status 200 (regardless of if the browser issues a if-modified-since or if-none-match header or not) instead of HTTP status 304?


Let me make your question a little simpler.. :)

What ?

  • Send 200 response instead of 304

How ?

Just add this configuration in your Apache setup.

<filesMatch "\.(xml)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"

Why ?

  • Setting this in your configuration would send header not to cache this file i.e. sitemap.
  • When sitemap isn't cached, the downloader (in this case the bot), would download file again and again, instead of just reading HEADER and leaving with 304.
  • By What I want to do is try to get search engines to rescan my sitemap files, I mean making it so that google actually rescans the files when I want instead of when it is good and ready to scan again. – Mike -- No longer here Oct 29 '15 at 16:18

I think, like this would help:

<FilesMatch "\.(xml)$">
ExpiresDefault A14515200

<files sitemap.xml> 
Header set last-modified "Sun Jul 00:00:00 EDT 2015" 

But i haven't tried, which answer code would have the sitemap.

Another way is to update your sitemap with help of Search Console API, like here:

PS: after i read your question twice, i think, these topics would be helpful too:

  • Your answer misses Cache-Control, Pragma, Expires and Etag headers, which might return 304 too. – skbly7 Oct 29 '15 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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