Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Serve missing media from a production server when dev site is at a subdirectory.
# Case: Dev site hosted at subdirectory (NGINX)
# ie.
# Serve Missing Media from a Production Server
location ~* \.(js|css|png|jpe?g|gif|ico)$ {
expires 24h;
log_not_found off;
try_files $uri $uri/ @production;
# Remove subdirectory from redirect
location @production {
rewrite ^/sub/(.*) /$1 break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment