Mobile app version of vmapp.org
Login or Join

Login to follow query

More posts by @Shakeerah822

2 Comments

Sorted by latest first Latest Oldest Best

 

@Caterina187

When you connect to your FTP server, create .htaccess file and paste one of these codes in it:

Adding Expire Headers

ExpiresActive On
ExpiresDefault A0

# 1 YEAR - doesn't change often
<FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A31536000
</FilesMatch>

# 1 WEEK - possible to be changed, unlikely
<FilesMatch ".(jpg|jpeg|png|gif|swf)$">
ExpiresDefault A604800
</FilesMatch>

# 3 HOUR - core content, changes quickly
<FilesMatch ".(txt|xml|js|css)$">
ExpiresDefault A10800
</FilesMatch>


Using max-age headers

# 1 YEAR
<FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>

# 1 WEEK
<FilesMatch ".(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

# 3 HOUR
<FilesMatch ".(txt|xml|js|css)$">
Header set Cache-Control "max-age=10800"
</FilesMatch>

# NEVER CACHE - notice the extra directives
<FilesMatch ".(html|htm|php|cgi|pl)$">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
</FilesMatch>


Both of these types cache files with the extension that is in parentheses "()".
You can change these file extensions if you feel some files are going to be edited more frequently. Don't forget to split them with the vertical bar "|"

You can check if your caching works on Redbot.org

More about HTTP caching here

10% popularity Vote Up Vote Down


 

@Moriarity557

Easiest way would be to use a CDN like Cloudflare. They will automatically cache your static resources, and serve them over HTTP2 as well if you want. This should have an immediate effect on the speed of your site.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme