Solved

Cannot Add Expire Header YSLOW

Posted on 2010-11-20
3
617 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 61

Accepted Solution

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

Author Closing Comment

by:lieYawen
Comment Utility
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 61

Expert Comment

by:gheist
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the following article I will try to explain some of the issues I had learning Joomla and I hope this helps all of you beginners out there that love the concept but find it confusing and difficult to manage and configure a Joomla website. Like …
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now