Last active
July 12, 2019 19:49
-
-
Save celsowhite/af93527b2833ea4867a77b9910fba28b to your computer and use it in GitHub Desktop.
Altered wordpress htaccess file to pull uploads from production
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
# Load media files from production server if they don't exist locally. | |
# Below snippet must be placed before wordpress default htaccess rules. | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule wp-content/uploads/(.*) http://production-url.com/wp-content/uploads/$1 [NC,L] | |
</IfModule> | |
# Allow CORS (Mainly used for enabling access to files via the REST API) | |
Header add Access-Control-Allow-Origin "*" | |
Header add Access-Control-Allow-Methods: "GET" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment