Last active
August 29, 2015 13:57
-
-
Save ksemel/6c013fe2d592fa629fea to your computer and use it in GitHub Desktop.
Run your WordPress site locally without copying down all your images
This file contains 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
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
# Single site Rules (with image pass-back) | |
################################################### | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
# if it is an image that doesn't exist, try prod | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^wp-content/uploads/(.*)$ http://[YOUR PRODUCTION SITE]/wp-content/uploads/$1 [R=301,L] | |
# if request is for image, css, or js file | |
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|css|js|ico)$ [NC,OR] | |
# or if URL resolves to existing file | |
RewriteCond %{REQUEST_FILENAME} -f [OR] | |
# or if URL resolves to existing directory | |
RewriteCond %{REQUEST_FILENAME} -d | |
# then skip the rewrite to WP | |
RewriteRule ^ - [S=1] | |
# else rewrite the request to WP | |
RewriteRule . /index.php [L] | |
</IfModule> | |
# END WordPress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment