我正在使用以下代码为资源管理器6-8加载不同的HTML和CSS:
<?php
$IE6 = (ereg('MSIE 6',$_SERVER['HTTP_USER_AGENT'])) ? true : false;
$IE7 = (ereg('MSIE 7',$_SERVER['HTTP_USER_AGENT'])) ? true : false;
$IE8 = (ereg('MSIE 8',$_SERVER['HTTP_USER_AGENT'])) ? true : false;
if (($IE6 == 1) || ($IE7 == 1) || ($IE8 == 1)) {
// some code
}
?>
它工作正常,直到我用插件Wp-rocket打开缓存。 这个插件只是在.htaccess文件中添加了一些代码。
我在.htaccess中添加了以下代码:RewriteCond%{HTTP_USER_AGENT}!(MSIE \ [6-8])[NC]:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} on
RewriteRule .* - [E=WPR_SSL:-https]
RewriteCond %{SERVER_PORT} ^443$
RewriteRule .* - [E=WPR_SSL:-https]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=WPR_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
RewriteCond %{REQUEST_URI} !^(.*/feed/)$ [NC]
#my code
RewriteCond %{HTTP_USER_AGENT} !(MSIE\ [6-8]) [NC]
RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}" -f
RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}" [L]
</IfModule>
但它不起作用。
那么,有没有办法只关闭6-8的资源管理器缓存?