Solved

Cannot Add Expire Header YSLOW

Posted on 2010-11-20
3
626 Views
Last Modified: 2012-05-10
Dear all,

How to add expire header via htaccsess successfully. I have tried methods such as.

( add to my htaccsess)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType image/x-icon A2592000
</IfModule>                                                              

but this code simply doesn't work. I try another method

# turn on the module for this directory
ExpiresActive on
# set default
ExpiresDefault "access plus 24 hours"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType text/javascript "access plus 1 months"
ExpiresByType application/javascript "access plus 1 months"
ExpiresByType application/x-shockwave-flash "access plus 1 months"

this method give me error on my wibesite ( error 500 )

I  try another method
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "access plus 1 weeks"
Header set Cache-Control "public"
</FilesMatch>
 and doesn't work as well

Could you please help me how to add expire header .

Thanks before
lie

0
Comment
Question by:lieYawen
  • 2
3 Comments
 
LVL 62

Accepted Solution

by:
gheist earned 500 total points
ID: 34185966
You need to load expires module (uncomment it in httpd.conf)
0
 

Author Closing Comment

by:lieYawen
ID: 34192773
Hi gheist,

Thanks a lot for your help. Yes you're right. but unfortunately  my web hosting doesn't  support Mod_Expire for shared hosting.

Regards
Lie

0
 
LVL 62

Expert Comment

by:gheist
ID: 34193072
Have you asked?
You can push headers from e.g php pages, but server provisions are better.
Your ifmodule directives will adapt your provider loading the module.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question