slider images loading twice after cache control

馋奶兔 提交于 2019-12-11 09:35:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!