简体   繁体   English

RewriteRule和Header集Expires:如何

[英]RewriteRule & Header set Expires : how to

I'm using rewrite rules to create a /fr /en on my website and does folder don't exist, therefore if I try to use 我正在使用重写规则在我的网站上创建/ fr / en,并且文件夹不存在,因此,如果我尝试使用

<Directory /fr>
ExpiresDefault "access plus 1 day"
</Directory> 

Apache complain because the folder does not exist, can't find a way to do it in the http.conf Apache抱怨该文件夹不存在,无法在http.conf中找到解决方法

If I use 如果我用

Header set Expires "access plus 1 day"

in the .htaccess, can see the header showing 在.htaccess中,可以看到标题显示

Expires: access plus 1 day  

instead of the date + 1 day, if i remove it I can see 而不是日期+ 1天,如果我将其删除,我可以看到

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Also if I use 另外,如果我使用

ExpiresDefault "access plus 1 day"

It does not work... 这是行不通的...

Can you please tell how to get this right? 你能告诉我如何正确处理吗?

Also I believe that Safari (and only safari) keep on reloading the page every minutes because of that, is that correct or just another issue? 我也相信Safari(并且只有野生动物园)会因此每分钟不断地重新加载页面,是正确的还是另一个问题?

Thx for your help! 谢谢您的帮助!

Directory instructions are working on real filesystem paths. 目录指令正在实际的文件系统路径上工作。 So a Directory setting should looks like : 因此,目录设置应类似于:

<Directory /var/www/foo/bar/fr >
    (...)
</Directory>

Instead, if you prefer working with url path you must use Location directives: 相反,如果您更喜欢使用url路径,则必须使用Location指令:

<Location /fr >
    (...)
</Location>

This should at least fix your inexistents directories problems (if I understand your first sentence, which is quite strange) 这至少应该解决您不存在的目录问题(如果我理解您的第一句话,这很奇怪)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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