Created
December 27, 2019 14:07
-
-
Save aaronsummers/4539789a03794bc663389c5e1047591e to your computer and use it in GitHub Desktop.
redirect localhost images from wordpress to production server
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
# my local and production sites use /blog/ as a directory for WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} ^/blog/wp-content/uploads/[^\/]*/.*$ | |
RewriteRule ^(.*)$ https://www.example.com/blog/$1 [QSA,L] | |
</IfModule> | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /blog/ | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /blog/index.php [L] | |
</IfModule> | |
# END WordPress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This only works with the uploads rewrite above
# Begin WordPress