Reputation: 6439
If I load up a file to my server (an apache) via FTP, the file is correctly uploadet, but when I open it in any browser, an older version of that file is shown (btw, it's a php file). I think, resetting the servers cache will solve the problem, but how can I do this?
Can I use php for this? I've found somethin called htcacheclear in the web, but I don't understand. how to use it. The main problem is, that I have no access to a Terminal or Console, that would be a kind of easy...
Any solution?
Upvotes: 1
Views: 3316
Reputation: 1185
1) Simply changing the file name serve new files.
OR
2) You can use Apache httpd.conf to do this. Enable mod_headers.so module from httpd.conf and apply those settings at the end of file.
<IfModule mod_headers.c>
ExpiresActive On
<FilesMatch "!.(gif|jpe?g|png|js|css|php)$">
ExpiresACtive On
ExpiresDefault "access plus 1 year"
Header unset Cookie
Header unset Set-Cookie
php_value session.cookie_domain example.com
</FilesMatch>
<FilesMatch "\\.(x?html?|php)$">
Header set Cache-Control "max-age=600, private, must-revalidate"
</FilesMatch>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf|woff)$">
Header set Cache-Control "max-age=31536000, public"
Header unset Cookie
Header unset Set-Cookie
</FilesMatch>
<FilesMatch "\\.(css)$">
Header set Cache-Control "max-age=2692000, public"
#ExpiresDefault A29030400
</FilesMatch>
<FilesMatch "\.(js)$">
#Header set Cache-Control "max-age=2692000, public"
ExpiresDefault A29030400
</FilesMatch>
<FilesMatch "\\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
Header unset Pragma
FileETag None
Header unset ETag
Header append Cache-Control "public"
</IfModule>
Upvotes: 1