Forum

Thread tagged as: Question, Problem, Runway

Broken Cache Busting Redirects in Perch Runway

I'm using Perch Runway

Recently I have been trying to set up a cache busting technique that Jay helpfully had documented here.

I have my .css and .js files being name using the timestamp of the file with success like so: /assets/css/style.min.1487201825.css redirects to /assets/css/style.min.css

However I find some of the Perch Runway Rewrites are stopping the Cache Busting Rewrite and my .css and .js fails to be applied to the site.

Firstly I remove the following lines from my .htaccess...

RewriteCond %{REQUEST_URI} !^/login
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /login/core/runway/start.php [L]

Secondly I visit /assets/css/style.min.1487201825.css I get successfully rewritten to /assets/css/style.min.css. Pasting the removed Runway lines back into the .htaccess file and refreshing the page loads the page with the correct styles. When the css and js files get updated the name is going to change and the files wont redirect alongside the Runway lines. Obviously that is not going to be a solution going forward...

What is happening and how do I fix this? Full code for .htaccess is below:

.htaccess file

# Perch Runway
RewriteEngine On

#Perch Runway
RewriteCond %{REQUEST_URI} !^/login
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /login/core/runway/start.php [L]

#The CSS and JS rewrite 
RewriteRule (assets[/])([^.]*).min.+.(css|js)$ $1$2.min.$3
Dan Lee

Dan Lee 1 points

  • 4 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

You probably want your CSS rule before the Runway rule.

Dan Lee

Dan Lee 1 points

Thanks Duncan,

Such a simple solution!

Duncan Revell

Duncan Revell 78 points
Registered Developer

Excellent!