混合两个文件htaccess
问题描述:
我需要专家的帮助。混合两个文件htaccess
我试图将两种文件的htaccess
第一:
<IfModule mod_mime.c>
<FilesMatch "\.html\.gz$">
ForceType text/html
FileETag None
</FilesMatch>
AddEncoding gzip .gz
AddType text/html .gz
</IfModule>
<IfModule mod_deflate.c>
SetEnvIfNoCase Request_URI \.gz$ no-gzip
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control 'max-age=300, must-revalidate'
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html A300
</IfModule>
第二:
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<FilesMatch "\.(js|css|pdf|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
第一个文件所用的插件WP-supercache(worpress)
我想这
image files Cache-Control = 2592000
files as css e js Cache-Control = 604800
files htm had Cache-Control = 43200
但它想不失去插件,并为此我寻求帮助的功能。
非常感谢你和原谅我的英语
维拉
答
这似乎是你缺少Apache中headers
模块(我假设的Apache2在下面,但语法应该接近相似)。这个作品在我的机器上(无头模块加载):
<IfModule mod_mime.c>
<FilesMatch "\.html\.gz$">
ForceType text/html
FileETag None
</FilesMatch>
AddEncoding gzip .gz
AddType text/html .gz
</IfModule>
<IfModule mod_deflate.c>
SetEnvIfNoCase Request_URI \.gz$ no-gzip
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control 'max-age=300, must-revalidate'
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html A300
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<FilesMatch "\.(js|css|pdf|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
</IfModule>
要启用的Apache2的headers
模块:
a2endmod headers
apache2ctl restart
找到一个解决办法?如果你仍然有问题,请看我的答案,这可能是因为Apache2中缺少一个模块。 – 2009-12-10 23:16:49