Created
July 30, 2015 21:03
-
-
Save dtateii/70173b998fde3d437d57 to your computer and use it in GitHub Desktop.
Local Dev: Forward User-Generated Image Requests to Server
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
# APACHE RULE: DRUPAL (inside .htaccess) | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule sites/default/files/(.*) \ | |
http://{site.com}/sites/default/files/$1 [NC,L] | |
</IfModule> | |
# APACHE RULE: WORDPRESS (inside .htaccess) | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule wp-content/uploads/(.*) \ | |
http://{site.com}/wp-content/uploads/$1 [NC,L] | |
</IfModule> | |
# NGINX RULE: DRUPAL (inside server block) | |
location ~ ^/sites/default/files/(.*)\.(jpg|gif|png)$ { | |
rewrite ^(.*)$ http://{site.com}$1 last; | |
} | |
# NGINX RULE: WORDPRESS (inside server block) | |
location ~ ^/wp-content/uploads/(.*)\.(jpg|gif|png)$ { | |
rewrite ^(.*)$ http://{site.com}$1 last; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment