1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 Caching style elements

Discussion in 'Troubleshooting and Problems' started by Jeff Fuqua, Jun 15, 2012.

  1. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    I'm attempting to speed up my site and see that many of my style elements are recommended for longer caching because they have a "short freshness lifetime". Is there a way to specify an expiration of a week or more somewhere in the admin? Thanks.
     
  2. DBA

    DBA Well-Known Member

    Add something like this to your root .htaccess file (what I use on my site).

    Code:
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|css|js)$">
    Header set Cache-Control "max-age=2592000, public, must-revalidate"
    </FilesMatch>
     
    #SetOutputFilter DEFLATE
    AddOutputFilter DEFLATE xhtml html htm php css js xml xsl txt plain javascript x-javascript ico
     
    Jeff Fuqua likes this.
  3. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    Thanks for your help. What does this do? I do have a number of images which change often on my site. But things like the menu bars, etc. would not.
     
  4. DBA

    DBA Well-Known Member

    Top part controls the caching and the bottom part takes care of the compression.

    If you wanted to you could technically set the cache for 1 year without any issues. Just make sure to rename your new images. For example your current header image is called logo.jpg, so next time you change it call it logo2.jpg or something else.
     
    Jeff Fuqua likes this.
  5. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    That would be great for me as long as News Slider would work since all those images go by the same name.
     
  6. DBA

    DBA Well-Known Member

    Are you referring to the go titans site or something else?


    BTW it should be go Colts! :p
     
  7. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    Yes. I'm using xenporta which must have all news slider photos named slide.jpg.

    I'll overlook that Colts comment since you are sharing knowledge with me. ;)
     
  8. DBA

    DBA Well-Known Member

    I'm not familiar with the news slider, could you please PM me the site link. I'm pretty sure that the images still have a unique name.

    Yeah I actually don't care that much about football, I'm more of a motocross guy, however I'm still a Hoosier. Lol
     
  9. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    My site is under construction but it's gotitans.com/xf.

    NewsSlider requires the attachment always be the same name. But the image is pulled from the thread so don't know how that would impact things.
     
    Yorick likes this.
  10. Chris D

    Chris D XenForo Developer Staff Member

    It shouldn't impact things. Although you always upload a file called slide.jpg, it's a forum attachment so it's appended with the attachment id. So all the URLs will be something like http://gotitans.com/xf/path/to/attachments/slide.jpg?123456 Or similar.

    So I don't think caching would be too much of a problem.
     
    Jeff Fuqua likes this.
  11. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    I'm going to give it a shot and see how it goes. Thanks for the help.
     
    Yorick likes this.
  12. Chris D

    Chris D XenForo Developer Staff Member

    By the way Jeff,

    I've had your e-mails. I will respond shortly. I've been crazy busy this week :(
     
  13. Jeff Fuqua

    Jeff Fuqua Well-Known Member

    I just added the code and ran a test and got my score in the cache area up. Thanks again.
     
  14. DBA

    DBA Well-Known Member

    Yorick confirmed what I thought happened with the news slider images, with them being uploaded they have an attachment ID appended to them. This would make them all unique. (y)

    BTW the XF version of GT looks a LOT better/cleaner.
     

Share This Page