enable leverage browser caching

Hello

I have a drupal site running on AWS. 4 months back I followed the guildelines in this forum for increasing page speed and caching and every thing went fine. Now i can see the leverage browser caching is in RED :frowning:

I have a linux server with mod_expires on - pagespeed disabled, etags disabled.
I have added the following in my .htaccess

# Enable expirations. ExpiresActive On # Default directive ExpiresDefault “access plus 1 month”

ExpiresByType image/x-icon “access plus 1 year”
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”
ExpiresByType text/css “access plus 1 month”
ExpiresByType application/javascript “access plus 1 year”

ExpiresActive Off

Even after doing all these why the caching is not working? Can any one help me on this?

thanks!
Sathish

What’s the directive? I don’t see a matching open on it.

hi

i missed the full code in .htaccess - its here

# Enable expirations. ExpiresActive On # Default directive ExpiresDefault “access plus 1 month” ExpiresByType image/x-icon “access plus 1 year” 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” ExpiresByType text/css “access plus 1 month” ExpiresByType application/javascript “access plus 1 year”

<FilesMatch .php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off

thank you

Any chance you have a test result? Just want to check the file names and mime types. Are there any rewrite rules that would rewrite images to go through php?

And as a sanity check, you’re positive that mod_expires is still installed and enabled?

Hi

thank you for the quick reply. :slight_smile:
Yes the mod_expires is enabled - i am seing this when i type the command ‘dir /etc/apache2/mods-enabled’ in the Shell -

alias.conf autoindex.conf env.load php5.load
alias.load autoindex.load expires.load reqtimeout.conf
auth_basic.load cache.load headers.load reqtimeout.load
authn_file.load cgi.load mime.conf rewrite.load
authz_default.load deflate.conf mime.load setenvif.conf
authz_groupfile.load deflate.load negotiation.conf setenvif.load
authz_host.load dir.conf negotiation.load status.conf
authz_user.load dir.load php5.conf status.load

Please find the link for the test results here
http://www.webpagetest.org/result/120904_EZ_BZH/

thanks!
Sathish

The files themselves look like they have mime types and paths that should trigger the rule. Only things that jump out at me as possibilities:

  • mod_expires isn’t really active. What happens if you eliminate the IfModule check? You should start getting 500’s for page content if it isn’t enabled and it should have no impact if it is

  • .htaccess overrides are disabled

  • There is another .htaccess somewhere more specific in the path overriding the setting

  • There is a rewrite rule that routes all of the static files through a php handler for some reason

Hello

I will check if there is any other .htaccess file exists or not
Do i need to paste the full htaccess file details here?

thank you
Sathish

No, I’d say just check for other files and try removing the module check as an extra check to make sure it’s actually active.

hi

I will check for any additional .htaccess files

Could You please let me know why You feel that the mod expire is not enabled?

thank you
Sathish
[hr]
Helllo
I got one more .htaccess inside a demo folder. I will removed it after taking a backup.
Regarding the mod_expire - when i give the comman a2enmod expires - I am getting this message -“Module expires already enabled”

I will update You
thank you

Hi

Its all the same :frowning: the levrage browser caching is still Red…