.htaccess files
- Apache web server.
- .htaccess configuration files for Apache.
- Can have a different .htaccess file in each dir
-
Apache allows an enormous amount of customisation of your web server.
- Apache docs
- Say you are editing CSS.
- To stop CSS ever being cached, put it in a CSS dir, and put a .htaccess file like this in that dir:
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
<IfModule mod_headers.c>
FileETag None
Header unset ETag
Header unset Pragma
Header unset Cache-Control
Header unset Last-Modified
Header set Pragma "no-cache"
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
</IfModule>
- This tells the browser never to cache any file in that dir,
but to always fetch the new version from the server.
- To see if it is working:
On Chrome - DevTools - Network - Hard reload / Reload - see if it is coming from cache or not
Reference
student.computing.dcu.ie
On student.computing.dcu.ie:
Other examples of .htaccess