htaccess file content. I want to set expiration of my static contents like images, js, css
RewriteEngine On
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
My images location is
www.sitename.com/css/css/css files
www.sitename.com/images/img/images
like this
How about something like
<Directory "css/">
ExpiresDefault A0
Header set Cache-Control "max-age=0, no-cache, must-revalidate"
</Directory>
Where 0
is the time it expires in seconds.
Check mod_expires documentation.
You can use something like
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 12 hours"
</FilesMatch>