Pagina 1 van 1

Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 09:47
door nl1sms
Ik heb website speed test gedaan en hij geeft aan dat een aantal bestanden (jpg) niet in de cache staan. Zoals o.a. site_logo.jpg/gif.

Hoe kan ik dit in de cache zetten? Het zijn toch afbeeldingen die vaak geladen worden bij het benaderen van de website. Kan dit in phpBB en zo ja hoe ? Thx

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 17:59
door El torro
Dat moet in de .htaccess

Hier hoe ik het heb gedaan:

Code: Selecteer alles

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 30 days"
</IfModule>
## EXPIRES CACHING ##

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 18:04
door nl1sms
Top! Maar zet hij die jpg etc dan in de cache van de browser van de bezoeker of is het echt de server waar hij in de cache komt ?

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 18:09
door El torro
In de cache van de browser.

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 18:13
door nl1sms
Ok top..... ik heb het ook in mijn htaccess gezet..... Thx

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 20:11
door Froddelaar
Met onderstaande haal ik een hoge score op https://tools.pingdom.com
En forum vliegt vooruit!

Code: Selecteer alles

# Enable Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
</IfModule>
<IfModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

# Leverage Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
<IfModule mod_headers.c>
  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
  Header set Cache-Control "max-age=2678400, public"
  </filesmatch>
  <filesmatch "\.(html|htm)$">
  Header set Cache-Control "max-age=7200, private, must-revalidate"
  </filesmatch>
  <filesmatch "\.(pdf)$">
  Header set Cache-Control "max-age=86400, public"
  </filesmatch>
  <filesmatch "\.(js)$">
  Header set Cache-Control "max-age=2678400, private"
  </filesmatch>
</IfModule>

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 21:15
door El torro
¿En dan zet je gzip op het forum en in cPanel uit?

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 06 apr 2018, 21:32
door Froddelaar
El torro schreef:
06 apr 2018, 21:15
¿En dan zet je gzip op het forum en in cPanel uit?
gzip in het beheerderspaneel staat uit.
Is ingeschakeld op de server.

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 07 apr 2018, 08:58
door nl1sms
@Froddelaar Kan ik jouw htaccess ook gebruiken zonder dat ik gzip aan heb op de server noch control panel?

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 07 apr 2018, 12:37
door Froddelaar
nl1sms schreef:
07 apr 2018, 08:58
@Froddelaar Kan ik jouw htaccess ook gebruiken zonder dat ik gzip aan heb op de server noch control panel?
Volgens mij moet de gzip module toch wel aanstaan op de server.
Anders zal die cache niet werken ..
Beide inschakelen is niet goed, want daarmee kreeg "cache" ik foutmeldingen bij enkele extensies.

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 07 apr 2018, 13:10
door nl1sms
Dit er uit halen dus ?

Code: Selecteer alles

# Enable Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
</IfModule>

Re: Hoe afbeeldingen in cache zetten?

Geplaatst: 07 apr 2018, 14:39
door Froddelaar
nl1sms schreef:
07 apr 2018, 13:10
Dit er uit halen dus ?

Code: Selecteer alles

# Enable Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
</IfModule>
Goh geen idee, ik heb het er allemaal instaan.
gzip ingeschakeld op de server & uitgeschakeld in beheerderspaneel van het forum.