[英]“.htaccess” doesn't work for cache-control at sub directories
I made my own cache-control
rule in httpd.conf
. 我在
httpd.conf
制定了自己的cache-control
规则。 ANd need to apply different rules on each different sub directories. 并且需要在每个不同的子目录上应用不同的规则。
I made no-cache
for .do
extension for default( httpd.conf
). 我为
.do
扩展名( httpd.conf
)设置了no-cache
。
# 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
). 并且需要缓存一些目录(
.htaccess
)。
example URL : XXX.com/en/product.do
范例网址:
XXX.com/en/product.do
So I made a .htaccess
on <webRoot>/en
. 所以我在
<webRoot>/en
上做了一个.htaccess
文件。
<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
; .htaccess
不能使用<locationMatch>
类的东西; it will generate a runtime error. 它将生成运行时错误。
Also, usually *.do
is proxied, in which case no filesystem directory would ever be read for .htaccess
. 同样,通常使用
*.do
作为代理,在这种情况下, .htaccess
不会读取任何文件系统目录。
I suggest putting the second stanza first, and adding ^/en/
to the front. 我建议将第二个节放在第一位,并在前面添加
^/en/
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.