2017-02-18 32 views
1

我用SocialEngine为我的网站,我想加快自己的网站,所以我已经使用Gtmetrix和的PageSpeed,看看有什么我可以提高如何添加截止日期Css.php文件头(支架)

我看到添加过期头部有0/100 ..

我做研究,但我怎么能在Exprires添加页眉我的CSS看起来像这样..

https://www.exemple.com/application/css.php?request=application%2Fthemes%2Fmytheme%2Ftheme.css&c=2174&pageStart=332433&pageEnd=85951 
https://www.exemple.com/application/css.php?request=application%2Fthemes%2Fmytheme%2Ftheme.css&c=2174&pageStart=667827&pageEnd=345656 
https://www.exemple.com/application/css.php?request=application%2Fthemes%2Fmytheme%2Ftheme.css&c=2174&pageStart=1019386&pageEnd=6576458 

我该怎么办?谢谢

我的.htaccess:

<IfModule mod_expires.c> 
# Enable expirations 
ExpiresActive On 
# Default directive 
ExpiresDefault "access plus 1 month" 
# My favicon 
ExpiresByType image/x-icon "access plus 1 year” 
# Images 
ExpiresByType image/gif "access plus 1 month" 
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/jpg "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
# CSS 
ExpiresByType text/css "access 1 month” 
# Javascript 
ExpiresByType application/javascript "access plus 1 year" 
</IfModule> 

主题/应用/主题/ *我们利用一个名为CSS 脚手架的框架,使编辑社区的主题,一个简单的过程。 每个主题都存储在自己的目录 /applications/themes /中。 您首次安装SocialEngine时会自动加载默认主题。每个主题包含两个文件: constants.css和theme.css。

在constants.css的顶部,您会发现一系列全局CSS 设置(称为“常量”)。您可以编辑这些文件以在整个社区中调整颜色,字体和其他样式。

其他文件theme.css包含在整个社区中使用的更具体的样式 。这些样式中的很多都继承了来自 constants.css的值。如果您想覆盖您的社区的任何默认样式,您可以在此处进行编辑。如果它们不在 theme.css中(并且正在从主题本身之外加载),那么 可以通过向theme.css的底部添加新样式来覆盖它们。

有关如何使用CSS脚手架的更多信息,请访问GitHub上的 Github或Google for CSScaffold获取视频和教程。

回答

0

您已经配置

ExpiresByType text/css "access 1 month” 

所以CSS文件应该有正确的标题。

看来,application/css.php提供了相应的CSS文件。为了触发expires头文件,脚本还必须为返回的CSS文件设置正确的MIME类型。

这可以用Content-Type

header('Content-Type: text/css'); 

另外一个header,你也可以添加自己的Expires头,例如完成

$plus_month = date('r', strtotime('+1 month')); 
header("Expires: " . $plus_month);