1

I use SocialEngine for my website, I want to speed my website so I have use Gtmetrix and PageSpeed to see what I can improve

I see that Add Expires headers have 0/100 ..

I have do research but how I can add on Exprires headers my CSS that look like this ..

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

How I can do ? Thank you

My .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>

Themes /application/themes/* We utilize a framework called CSS Scaffold which makes editing your community's theme a simple process. Each theme is stored in its own directory within /applications/themes/. A default theme is automatically loaded when you first install SocialEngine. Each theme contains two files: constants.css and theme.css.

At the top of constants.css, you'll find a series of global CSS settings (called "constants"). You can edit these to adjust the colors, fonts, and other styles throughout your entire community.

The other file, theme.css, contains more specific styles that are used throughout your community. Many of these styles inherit values from constants.css. If you want to override any of the default styles on your community, you can edit them here. If they aren't present in theme.css (and are being loaded from outside the theme itself), you can override them by adding new styles to the bottom of theme.css.

More information about how to work with CSS Scaffold is available on Github or Google for CSScaffold for videos and tutorials.

Rocstar
  • 1,427
  • 3
  • 23
  • 41

1 Answers1

0

You already have configured

ExpiresByType text/css "access 1 month”

so CSS files should have the correct header.

It seems, that application/css.php delivers the appropriate CSS file. In order to trigger the expires header, the script must also set the correct mime type for the CSS files returned.

This can be accomplished with a header of Content-Type

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

Alternatively, you could also add your own Expires header, e.g.

$plus_month = date('r', strtotime('+1 month'));
header("Expires: " . $plus_month);
Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198