Skip to content

Instantly share code, notes, and snippets.

@robneu
Forked from brichards/.htaccess
Last active February 1, 2017 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robneu/cbc5f5dd4330197ca8211ba5d703012c to your computer and use it in GitHub Desktop.
Save robneu/cbc5f5dd4330197ca8211ba5d703012c to your computer and use it in GitHub Desktop.
Tell Apache to serve missing images from a remote server. Props http://stackoverflow.com/questions/5130410/modrewrite-to-another-server-if-file-image-is-not-found
# BEGIN serve images from production
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*\.(js|css|png|jpe?g|gif|ico|svg)) http://example.com/$1 [NC,P,L]
</IfModule>
# END serve images from production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment