Skip to content

Instantly share code, notes, and snippets.

@pbull
Created June 11, 2014 17:42
Show Gist options
  • Save pbull/0a68d8954a60865252c1 to your computer and use it in GitHub Desktop.
Save pbull/0a68d8954a60865252c1 to your computer and use it in GitHub Desktop.
Rewrite requests to production server for localhost install.
### Apache Rewrite
# Force image styles that have local files that exist to be generated.
RewriteCond %{REQUEST_URI} ^/sites/([^\/]*)/files/styles/[^\/]*/public/((.*))$
RewriteCond %{DOCUMENT_ROOT}/sites/%1/files/%2 -f
RewriteRule ^(.*)$ $1 [QSA,L]
# Otherwise, send anything else that's in the files directory to the
# production server.
RewriteCond %{REQUEST_URI} ^/sites/[^\/]*/files/.*$
RewriteCond %{REQUEST_URI} !^/sites/[^\/]*/files/css/.*$
RewriteCond %{REQUEST_URI} !^/sites/[^\/]*/files/js/.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [QSA,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment