Skip to content

Instantly share code, notes, and snippets.

@jacobmc
Created October 22, 2021 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobmc/db3062b2b8e2b775735c3864c897ec15 to your computer and use it in GitHub Desktop.
Save jacobmc/db3062b2b8e2b775735c3864c897ec15 to your computer and use it in GitHub Desktop.
Rewrites file paths to come from production if they don't exist locally. Add to top of .htaccess
# BEGIN Dev Image
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.localhost$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^\/app\/uploads\/(?!beaverbuilder)[^\/]*\/.*$
RewriteRule ^(.*)$ https://www.example.com/$1 [QSA,L]
</IfModule>
# END Dev Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment