问题
I have use following code in my .htaccess
file for cache control in my joomla site.
########## Begin - ETag Optimization
## This rule will create an ETag for files based only on the modification
## timestamp and their size.
## Note: It may cause problems on your server and you may need to remove it
FileETag MTime Size
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
# Enable expiration control
ExpiresActive On
# Default expiration: 1 month after request
ExpiresDefault "now plus 1 month"
# CSS and JS expiration: 1 month after request
ExpiresByType text/css "now plus 1 month"
ExpiresByType application/javascript "now plus 1 month"
ExpiresByType application/x-javascript "now plus 1 month"
# Image files expiration: 1 month after request
ExpiresByType image/bmp "now plus 1 month"
ExpiresByType image/gif "now plus 1 month"
ExpiresByType image/jpeg "now plus 1 month"
ExpiresByType image/jp2 "now plus 1 month"
ExpiresByType image/pipeg "now plus 1 month"
ExpiresByType image/png "now plus 1 month"
ExpiresByType image/svg+xml "now plus 1 month"
ExpiresByType image/tiff "now plus 1 month"
ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
ExpiresByType image/x-icon "now plus 1 month"
ExpiresByType image/ico "now plus 1 month"
ExpiresByType image/icon "now plus 1 month"
ExpiresByType text/ico "now plus 1 month"
ExpiresByType application/ico "now plus 1 month"
ExpiresByType image/vnd.wap.wbmp "now plus 1 month"
ExpiresByType application/vnd.wap.wbxml "now plus 1 month"
cache control started working but i am facing a problem.
Now my slider image is loading two times before appearing. once image is loaded then it again loads ( just like refresh ), but other content is loading correctly.
Please help me out.
I am using DJ-ImageSlider extension of joomla. slider does not slide anything, it just show a single image as a banner.
回答1:
ETags
are difficult because they take precedence for caching in most browsers. You can change all the headers you want, but if the ETag
associated with a file is always the same, caching will never work how you expect. In most situations, you should turn your ETag
headers off.
Source - David Walsh
So to unset the ETag
, you can use the following:
Header unset ETag
and remove this:
FileETag MTime Size
回答2:
It's difficult to troubleshoot at a distance, but a few ideas you could try.
First make sure you are starting with a clean slate by clearing your browser cache and your Joomla cache, and repeat this step after any changes below.
If problem persists, try going to extensions > module manager > DJ-ImageSlider > Advanced and changing the caching setting.
If still no joy, perhaps play with the cache settings in System > Global Configuration > Cache Settings.
Good luck!
来源:https://stackoverflow.com/questions/27016471/slider-images-loading-twice-after-cache-control