Last active
June 27, 2016 18:12
-
-
Save cobbman/dfb885a959840b7b436f46a58504fbc9 to your computer and use it in GitHub Desktop.
Checks for local files in wp-content/uploads and rewrites the URL to the live server if needed. Also checks that the HOST is local, so it won't run outside of your dev URL.
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
// Place this BEFORE the WordPress Rewrite rules | |
// Be sure to edit LOCALHOST and LIVESITE with the proper URL's | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /wp-content/uploads/ | |
RewriteCond %{HTTP_HOST} ^LOCALHOST\.dev$ [NC] | |
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/ | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ http://LIVESITE.com/$1 [R,L,NC] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just used this. It is sweet!!!