Welcome Guest, Not a member yet? Register   Sign In
Override Cache, Caching CSS, images, etc?
#1

[eluser]Buso[/eluser]
Hi there, I have two questions:
- How can I override cache only for members? (logged in users) I need this because when they log in, more options appear on the same pages (same urls), and they won't be able to see them if the pages are cached. Also, it would suck if the first hit was from a member, and every user (members and not members) start seeing the only-members options.
- I keep reading everywhere that I should cache CSS and images, but can't find anywhere how to do this. Any useful links? Direct help is also welcome =D, indeed.

The main point is to optimize my site (Wallpapers, Images, Backgrounds, Desktops), so if there is anything else I should know, please point it out.

Thanks in advance. Smile
#2

[eluser]Buso[/eluser]
nothing yet? =(
#3

[eluser]Exxon[/eluser]
Hi let me see if I can help you. To cache images, css and js you can use .htaccess.

Code:
#Caching
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0

# Set up caching on media files for 1 year (forever?)
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</FilesMatch>

# Set up caching on media files for 1 week
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
ExpiresDefault A604800
Header append Cache-Control "public"
</FilesMatch>

# Set up 2 Hour caching on commonly updated files
<FilesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A7200
Header append Cache-Control "proxy-revalidate"
</FilesMatch>

# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
#Caching

Just note this is intense caching and can be pain while still in development or changing images so customize it to suit you.

About the codeigniter cache you will have to wait for someone who actually knows how it works, not one of my websites have ever grown so much that I need cache so I have no idea. Sorry
#4

[eluser]Buso[/eluser]
thanks! =)




Theme © iAndrew 2016 - Forum software by © MyBB