Created
July 19, 2012 02:21
-
-
Save bwiggs/3140348 to your computer and use it in GitHub Desktop.
CakePHP Filename Cache Busting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ index.php [QSA,L] | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppHelper extends Helper { | |
/** | |
* Override so that the timestamp is added to the file instead of as a query parameter, | |
*/ | |
public function assetTimestamp($path) { | |
$parts = explode('?', parent::assetTimestamp($path)); | |
return substr_replace($parts[0], '.'.$parts[1], strrpos($parts[0],'.'), 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have test your gist with the lastest CakePHP and it dosn't seems to work.
Can you help me please ?