Skip to content

Instantly share code, notes, and snippets.

@daveaspinall
Last active November 27, 2015 08:40
Show Gist options
  • Save daveaspinall/579152fa35f70bfc21e3 to your computer and use it in GitHub Desktop.
Save daveaspinall/579152fa35f70bfc21e3 to your computer and use it in GitHub Desktop.
Redirect all requests to wp-uploads to staging site
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect upload requests to staging site
RewriteRule ^wp-content/uploads/(.*)$ http://staging.domain.com/wp-content/uploads/$1 [L,R=301]
# WP redirects follow...
RewriteBase /
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