From 57541f61b3a61b883f4ec9b5f3f92a211fbd23d6 Mon Sep 17 00:00:00 2001 From: Leevi Graham Date: Fri, 3 Feb 2017 21:43:16 +1100 Subject: [PATCH] Update README.md --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8e7df22..5ad7d7d 100644 --- a/README.md +++ b/README.md @@ -30,18 +30,47 @@ After revving: http://example.com/uploads/images/_572x430_crop_center-center_80/James-Ellis_elevation-render-1.1485302752.jpg -Here's the method: - -```php -public function revUrl(AssetFileModel $asset, $transform) -{ - return str_replace( - $asset->getExtension(), - $asset->dateModified->getTimestamp().'.'.$asset->getExtension(), - $asset->getUrl($transform) - ); -} -``` +### Updating your server config + +This plugin doesn't actually change the the filename on the server. You'll need to implement rewrite rules on your server. + +#### Apache + +See: https://github.com/h5bp/server-configs-apache/blob/master/dist/.htaccess#L968-L984 + + # ---------------------------------------------------------------------- + # | Filename-based cache busting | + # ---------------------------------------------------------------------- + + # If you're not using a build process to manage your filename version + # revving, you might want to consider enabling the following directives + # to route all requests such as `/style.12345.css` to `/style.css`. + # + # To understand why this is important and even a better solution than + # using something like `*.css?v231`, please see: + # http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ + + # + # RewriteEngine On + # RewriteCond %{REQUEST_FILENAME} !-f + # RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1.$3 [L] + # + +#### NGINX + +See: https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/cache-busting.conf#L1-L10 + + # Built-in filename-based cache busting + + # This will route all requests for /css/style.20120716.css to /css/style.css + # Read also this: github.com/h5bp/html5-boilerplate/wiki/cachebusting + # This is not included by default, because it'd be better if you use the build + # script to manage the file names. + location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$ { + try_files $uri $1.$2; + } + + [](http://newism.com.au/)