[solved] How to leverage browser caching for both mobile and desktop?
Board index / PHP Melody - Video CMS
3 posts • Page 1 of 1
Due to this site's speed is slow. How can I do it?
- dpak1992
- Non-verified
- Posts: 8
- Joined: Aug 14, 2015 2 pm
- Reputation points: 0
You can do this via the .htaccess file.
If you look in the root of your video site via FTP, you should see an .htaccess file. You can edit it in something like Notepad or Notepad++. Grab that and to go the bottom. Add:
Those are just some defaults. You can tweak the timeframes. The ExpiresDefault "access plus 1 month" bit defines an expiry for anything else that's not listed in the bits above it.
While you are in there, it doesn't hurt to get gzip going on as well. These two do wonders for pagespeed scores. To enable gzip in your .htaccess file throw this in below the caching stuff
If you look in the root of your video site via FTP, you should see an .htaccess file. You can edit it in something like Notepad or Notepad++. Grab that and to go the bottom. Add:
- Code: Select all
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 month"
</IfModule>
## EXPIRES CACHING ##
Those are just some defaults. You can tweak the timeframes. The ExpiresDefault "access plus 1 month" bit defines an expiry for anything else that's not listed in the bits above it.
While you are in there, it doesn't hurt to get gzip going on as well. These two do wonders for pagespeed scores. To enable gzip in your .htaccess file throw this in below the caching stuff
- Code: Select all
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
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
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
- DocBray
- Non-verified
- Posts: 12
- Joined: Oct 02, 2016 11 pm
- Reputation points: 10
Thanks for these speed tips 

- kuss
- Verified Customer
- Posts: 4
- Joined: Dec 19, 2016 2 pm
- Reputation points: 0
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests