Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running apache2 on Ubuntu. I want to set expiration header like this.

ExpiresActive On
<FilesMatch "\.(ico|gif|jpe?g|png|js|css)$">
  ExpiresDefault "access plus 1 year"

I understang that it will cache a url like for one year.

My question is what about url like this. . Assuming that the above url is cached. Now if I change the url to will browser request for new js file?

Basically I am trying to find while caching does browser take into account full url including the data after the question mark.

Also my current vhost configuration looks like this

<VirtualHost xx.xx.xx.xx:80>
  ServerName xxxx
  ServerAlias xxxxx
  DocumentRoot /home/xxx/current/public
  <Directory "/home/xxxx/current/public">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
  <Location />
    # Insert filter
    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    # Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary


I am assuming that I can put ExpiresActive On and other statements just before tag begins.

share|improve this question

It's ok. According to your configuration all.js?123456 will request a new version of all.js . Also you can put ExpiresActiveOn inside a virtual host or directory .

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.