我刚刚设置好的一个地方environament具有相同的code,我不得不在生产environament成一个无业游民的虚拟机ubuntu32,
I just setted up a local environament with same code that I had in production environament into a vagrant virtual machine with ubuntu32,
的事情是,我得到了内部服务器错误与我的所有规则的的.htaccess 文件
The thing is that I got Internal Server Error with all my rules in the .htaccess file
于是,我开始去除code分离块,这是麻烦的:
So I started removing separated blocks of code and this was the trouble:
# 1 weeks <FilesMatch "\.(js|css)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch> # 1 weeks <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch> # 1 MIN <FilesMatch "\.(html|htm|php)$"> Header set Cache-Control "max-age=60, private, proxy-revalidate" </FilesMatch>的事情是,我想用完全相同的code所有environaments,是有办法,我只能包括&LT的该块; filesMatch&GT; 如果已经在本地主机?
The thing is that I would like to use the exact same code for all environaments, is there a way I can only include that block of <filesMatch> only if not in localhost?
我发现这个回答但它只是指一个页面,而不是主机名称。
I found this answer but it just refers to a page, not the host name.
推荐答案您也许可以做:
SetEnvIf Host ^ NON_LOCAL SetEnvIf Host localhost !NON_LOCAL <FilesMatch "\.(js|css)$"> Header set Cache-Control "max-age=604800, public" env=NON_LOCAL </FilesMatch> # 1 weeks <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=604800, public" env=NON_LOCAL </FilesMatch> # 1 MIN <FilesMatch "\.(html|htm|php)$"> Header set Cache-Control "max-age=60, private, proxy-revalidate" env=NON_LOCAL </FilesMatch>更多推荐
htaccess的&LT; filesMatch&GT;只有当主机名匹配?
发布评论