Hello,

I have a question about .htaccess and server caching in Internet Explorer.
Internet explorer won't cache my css and js files, e.g. this is the reading
from the Network monitor in IE11 for style.css:

URL:
/bmgfolder/wp-content/themes/childoftwentythirteen/style.css?ver=2014-04-08
Protocol: HTTP
Method: GET
Result: 304
Type: text/css
Received: 201 B
Taken: <1 ms
Initiator: <link rel="stylesheet">

It does a similar thing for print.css, jquery.min.js and functions.js.

This is my .htaccess file:

---

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml
text/css application/x-javascript application/javascript
SetEnvIfNoCase Request_URI
.(?:exe|t?gz|zip|iso|tar|bz2|sit|rar|png|jpg|gif|jpeg|flv|swf)$ no-gzip
dont-vary
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.[0678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48, the above regex
won't work. You can use the following
# workaround (comment the above line and uncomment the below line) to get
the desired effect:
# BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html


# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

## EXPIRES CACHING ##
<IfModule mod_expires.c>
<FilesMatch "\.(jpe?g|png|gif|js|css|ico)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>
## EXPIRES CACHING ##

<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>

BrowserMatch "MSIE" brokenvary=1
BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
BrowserMatch "Opera" !brokenvary
SetEnvIf brokenvary 1 force-no-vary

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType text/x-javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
</IfModule>
## EXPIRES CACHING ##

---

Is there anything wrong with either my observation or my solution?

Kind regards,

Andrew

Reply via email to