Forum Moderators: open
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
trying to avoid my page to be cached and thus give users daily updated information since I publish some dates.
But I see in my IE my pages cached anyway so I guess that doesn't work.
How do I make non caching pages?
The easiest way to make a non-cacheable page is to use a server-side scipting language such as PHP or ASP - as the page is generated each time and many PHP/ASP sites include highly dynamic content, the result is not cacheable by default. If you are using static HTML served from an Apache server, then you can use the mod_expires [httpd.apache.org] and mod_headers [httpd.apache.org] directives to control caching.
ExpiresActive On
<FilesMatch "^index\html$">
ExpiresDefault A0
Header unset Cache-Control:
Header append Cache-Control: "no-cache, must-revalidate"
</FilesMatch>
I don't know if you can do something like that with CPanel. I use hosts without any panel. If you can't, you have to download your .htaccess and edit it yourself with a plain text editor.
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^209\.237\.232\.84$ [OR]
RewriteCond %{HTTP_USER_AGENT} ZyBorg/1\.0\ \( [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule .* - [F]
Redirect permanent /foo.htm http://www.mysite.com/
Should I add that at the end?
What does exactly the code you mention?
I added comments above every line to explain what it does
# Turn the module on
ExpiresActive On
# if filename matches "index.html"
<FilesMatch "^index\.html$">
# this file expires in 0 seconds
ExpiresDefault A0
# remove existing Cache-Control header
Header unset Cache-Control:
# add this header
Header append Cache-Control: "no-cache, must-revalidate"
</FilesMatch>
You can check your page headers with the Header checker in your profile.
For more info: mod_expires [httpd.apache.org], mod_headers [httpd.apache.org]