Skip to content

Instantly share code, notes, and snippets.

@tanmay27vats
Created January 3, 2018 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tanmay27vats/af8a8605286de4e0792dd9c438752b0a to your computer and use it in GitHub Desktop.
Save tanmay27vats/af8a8605286de4e0792dd9c438752b0a to your computer and use it in GitHub Desktop.
Wordpress: How to use live images on localhost?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# custom rules for loading server images or any other uploaded media files locally.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^localhost$
RewriteRule ^.*/uploads/(.*)$ http://livesiteurl.com/wp-content/uploads/$1 [L,R=301,NC]
# default WordPress rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment