htaccess file content.我想设置静态内容的过期时间,如图像、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]
我的图像位置是
www.sitename.com/css/css/css files
www.sitename.com/images/img/images
喜欢这个
像这样的东西怎么样
<Directory "css/">
ExpiresDefault A0
Header set Cache-Control "max-age=0, no-cache, must-revalidate"
</Directory>
其中0
是它以秒为单位的过期时间。
查看mod_expires文档。
你可以使用类似的东西
<FilesMatch "'.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 12 hours"
</FilesMatch>