이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

Filename based asset cache busting

설명

Filename based cache busting for WordPress scripts/styles using last modified date.

Stop telling clients or users to hard refresh / shift refresh. The url to all of the css/js files on your site will change automatically whenever the files are modified. You can set proper long cache lifetimes to help get top scores on Google Pagespeed without running into cached css/javascript problems.

Based on this gist https://gist.github.com/ocean90/1966227 from Dominik Schilling, I’ve enhanced it by automatically replacing the asset version with the files modification time and automatically editing htaccess – making it install + forget.

Includes querystring option as a fallback – which works in more scenarios.

Webservers

Apache

The plugin should add what it needs to your .htaccess file jsut like WP itself. But if for any reason that doesn’t work for you – here’s what it adds:

# FBACB
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)\.([0-9\.]+)\.(js|css)$ $1.$3 [L]
</IfModule>

# still fbacb
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType text/css                            "access plus 1 year"
    ExpiresByType application/javascript              "access plus 1 year"
</IfModule>
# END FBACB

NGINX

 location ~* ^(.+)\.(?:\d+)\.(min.js|min.css|js|css)($|\?.*$) {
   try_files $uri $1.$2;
 }

Host specific notes

Some webhosts need a bit of custom config to get the filename based urls working.

WP Engine

To work on WP-Engine, you’ll need the following redirect added via my.wpengine -> installname -> Redirect rules

 Source: ^(.+)\.([0-9\.]+)\.(js|css)$
 Dest: $1.$3
 Type: break (this is under advanced)

CloudWays

Just works.

Flywheel

Just works.

PHP Fallback

If your webserver is failing to serve assets using url rewriting, the plugin attempts to serve them itsef (ie: via PHP). Obviously this is slow/less than ideal in production (it’ll be much slower) – so you should configure your web server correctly to serve the files. If you see this HTTP header “FBACB-Php-Fallback: yes” on your assets, this applies to you.

Note that hosts are increasingly configured to serve css/js directly from disk and won’t fall back to PHP + WordPress error handling – this fallback then won’t work.

후기

2019년 6월 27일
I was looking for something like Laravel's Elixir Cache bursting solution and found this plugin. Works great. To use this in nginx, add below line inside the server block of your site's nginx configuration # Support for Filename-based asset cache busting Plugin location ~* \.(?:css|js)$ { if (!-e $request_filename){ rewrite ^/(.+)\.([0-9\.]+)\.(js|css)$ /$1.$3 break; } }
2017년 4월 19일
Thanks for making this, simple, easy use and powerful! it helps me lot.
2017년 4월 3일
If you run a site that users browser caching, and you should, you should also be using some kind of cache busting. This plugin make it easy.
모든 5 평가 읽기

기여자 & 개발자

“Filename based asset cache busting”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “Filename based asset cache busting”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.