Skip to content

Instantly share code, notes, and snippets.

@technoweenie
Forked from carmelyne/gist:66719
Created February 19, 2009 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save technoweenie/66722 to your computer and use it in GitHub Desktop.
Save technoweenie/66722 to your computer and use it in GitHub Desktop.
# If cached file exists, serve it and stop processing
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ /cache/%{HTTP_HOST}$1 [L]
# other redirection (imgs, js, css, ...)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !.*/mephisto/.*
RewriteCond %{REQUEST_URI} !.*html
RewriteCond %{REQUEST_URI} !^/cache
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/$1 -f
RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}/$1 [QSA,L]
# nginx!
if (-f $document_root/cache/$host$uri/index.html) {
rewrite (.*) /cache/$host$1/index.html break;
}
if (-f $document_root/cache/$host$uri.html) {
rewrite (.*) /cache/$host$1.html break;
}
if (-f $document_root/cache/$host$uri) {
rewrite (.*) /cache/$host$1 break;
}
location ~ ^/assets/\d+/ {
rewrite ^/assets/(\d+)/(.+)$ /assets/$host/$1/$2 last;
}
location /assets {}
location /cache {}
location /plugins {}
location ~ ^/(images|javascripts|stylesheets)/mephisto {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment