gpt4 book ai didi

apache - 是否可以有条件地设置标题?

转载 作者:行者123 更新时间:2023-12-04 00:08:50 25 4
gpt4 key购买 nike

我要 .htaccess仅在 http_referer 时执行以下代码来自谷歌(.com/.ru/.co.uk/.co.in/等)。这可能吗?

<filesMatch ".(jpg|jpeg|png|gif)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</FilesMatch>

最佳答案

好吧,我发现您可以使用 mod_rewrite 以不同的方式设置 header ,从而更容易:

RewriteCond %{HTTP_USER_AGENT} !(googlebot|bingbot|Baiduspider) [NC]  
RewriteCond %{HTTP_REFERER} google [NC]
RewriteRule ^.*$ - [ENV=LONGCACHE:true]
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" env=LONGCACHE
Header set Pragma "no-cache" env=LONGCACHE
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" env=LONGCACHE

关于apache - 是否可以有条件地设置标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16074750/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com