Forked from rxnlabs/htaccess-redirect-load-images-from-production
Last active
April 13, 2023 11:55
-
-
Save viktorbijlenga/8950ece4c8498a21346c665927ddbca7 to your computer and use it in GitHub Desktop.
htaccess - Redirect image and file request from the localhost to the production host - Wordpress
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
# Place on top of Wordpress own redirect rules | |
# If a file (-f) or directory (-d) doesn't exist on the local host, | |
# A 302 redirect request is made to the production host. | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
#Redirect WordPress uploads | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule wp-content/uploads/(.*)$ http://www.example.com/wp-content/uploads/$1 [R=302,L,NC] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment