DelphiFAQ Home Search:

How I can set a time when my page expires?


comments5 comments. Current rating: 3 stars (2 votes). Leave comments and/ or rate it.


I need to supply an expiration date for my web page so that it does not get cached beyond that date. How should I do that?


Often you will see the advice to use a meta tag in the <HEAD> section of the page. While meta tags are easy to use, they are ineffective. That's because they're usually only honored by browser caches (which actually read the HTML), not proxy caches (which almost never read the HTML in the document).

The more effective place to put this information is in the actual HTTP headers (which are not displayed in the browser, not even with View-Source). These headers give you a lot of control over how both browser caches and proxies handle your objects. It is a bit more difficult to set the HTTP headers since they're usually generated by the web server.

In your case, you may want to add a Cache-Control or an Expires header. A typical example for such a header (containing both) would be:

HTTP/1.1 200 OK

Date: Fri, 30 Oct 1998 13:19:41 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, must-revalidate
Expires: Fri, 30 Oct 1998 14:19:41 GMT
Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT
ETag: "3e86-410-3596fbbc"
Content-Length: 1040
Content-Type: text/html


How do you get those headers to be delivered with your page?

If your content is generated by perl or another language, then the answer is easy. Simply add a print statement putting out the header.

For static documents under Apache, you can configure your headers in the .htaccess file. If you have an .htaccess file in your (www) root directory, it will affect all directories below. Ideally you'll have ssh access to your web server to perform this, but just plain ftp access will do too. The .htaccess file allows you to override Apache's defaults as they are set up in the configuration file.

Here's an example .htaccess file that demonstrates the use of some headers. As you see this .htaccess file references the Apache module mod_expires. You need to have this module installed; if not complain to your administrator or install it yourself.

### activate mod_expires
ExpiresActive On
### Expire .gif's 1 month from when they're accessed
### 2592000 = number of seconds in one month
ExpiresByType image/gif A2592000
### Expire everything else 1 day from when it's last modified
ExpiresDefault "modification plus 1 day"
### Apply a Cache-Control header to index.html
<Files index.html>
Header append Cache-Control "public, must-revalidate"
### Apply another header to the /images/ subdirectory
<Location /images/>
Header append Cache-Control "max-age=100"

Content-type: text/html


2005-11-29, 03:50:11
anonymous from India  
2006-02-14, 12:26:14
anonymous from United Kingdom  
This text is on a zillion web pages - why not write something ORIGINAL?
2006-02-14, 13:36:26
Peter (Admin) from United States  
I personally wrote this text. Please send me urls to those zillion sites that have my text.
Or did you mean a small part of the text only?

-Peter Tiemann
2006-04-29, 21:48:18
anonymous from Australia  
was greatly helpful!
2014-07-17, 06:58:14
anonymous from Indonesia  
kami sekeluarga tak lupa mengucapkan puji syukur kepada ALLAH S,W,T
dan terima kasih banyak kepada AKI atas nomor togel.nya yang AKI
berikan 4 angka 1366 alhamdulillah ternyata itu benar2 tembus AKI.
dan alhamdulillah sekarang saya bisa melunasi semua utan2 saya yang
ada sama tetangga.dan juga BANK BRI dan bukan hanya itu AKI. insya
allah saya akan coba untuk membuka usaha sendiri demi mencukupi
kebutuhan keluarga saya sehari-hari itu semua berkat bantuan AKI..
sekali lagi makasih banyak ya AKI… bagi saudara yang suka main togel
yang ingin merubah nasib seperti saya silahkan hubungi AKI SOLEH,,di
0823 1333 6747,, insya allah anda bisa seperti saya…menang togel 275
juta, wassalam.

dijamin 100% jebol saya sudah buktikan...sendiri....

Apakah anda termasuk dalam kategori di bawah ini !!!!

1'Dikejar-kejar hutang

2'Selaluh kalah dalam bermain togel

3'Barang berharga anda udah habis terjual Buat judi togel

4'Anda udah kemana-mana tapi tidak menghasilkan solusi yg tepat

5'Udah banyak Dukun togel yang kamu tempati minta angka jitunya
tapi tidak ada satupun yang berhasil..

Solusi yang tepat jangan anda putus aza....AKI SOLEH akan membantu
anda semua dengan Angka ritwal/GHOIB:
butuh angka togel 2D3D4D SGP / HKG / MALAYSIA / TOTO MAGNUM / dijamin
100% jebol
Apabila ada waktu
silahkan Hub: AKI SOLEH DI NO: (((082313336747))) ATAU <b><a href='' rel='nofollow'>KLIK DISINI</a></b>

angka GHOIB: singapur 2D/3D/4D/

angka GHOIB: hongkong 2D/3D/4D/

angka GHOIB; malaysia

angka GHOIB; toto magnum 4D/5D/6D/

angka GHOIB; laos



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: