简体   繁体   中英

“.htaccess” doesn't work for cache-control at sub directories

I made my own cache-control rule in httpd.conf . ANd need to apply different rules on each different sub directories.

I made no-cache for .do extension for default( httpd.conf ).

# use .htaccess files for overriding,
AccessFileName .htaccess

...


    <ifModule mod_headers.c>
      <LocationMatch "\.(do)$">
        Header append Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
      </LocationMatch>
    </ifModule>

And need to cache for some directories( .htaccess ).

example URL : XXX.com/en/product.do

So I made a .htaccess on <webRoot>/en .

<ifModule mod_headers.c>
  <LocationMatch "\.(do)$">
    Header set Cache-Control "max-age=216000, public, must-revalidate"
  </LocationMatch>
</ifModule>

Am I going wrong? Is there other way to rule different on different directories?

Nothing like <locationMatch> can be used in .htaccess ; it will generate a runtime error.

Also, usually *.do is proxied, in which case no filesystem directory would ever be read for .htaccess .

I suggest putting the second stanza first, and adding ^/en/ to the front.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM