0

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?

Mike -- No longer here
  • 13,650
  • 5
  • 29
  • 63

2 Answers2

2

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"
  </ifModule>
</filesMatch>

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.
skbly7
  • 131
  • 5
0

I think, like this would help:

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

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

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:

Evgeniy
  • 10,195
  • 1
  • 18
  • 49