How do I redirect image requests to a specific folder?
I currently have a vhost.conf file, setup for a staging server. The problem I'm running into is that I need to have the staging server actually call (only) images from the production server. So, all other file types will call from the staging server, but any image request pulls data from production server. How would I do this 开发者_如何转开发using Apache redirection? This is what I currently have in my vhost.conf file
<LocationMatch ".(jpg|gif|png)$">
SetHandler None
</LocationMatch>
Any ideas?
RewriteEngine On
RewriteRule ^(.+)\.(jpg|gif|png)$ http://production.com$1.$2 [L,R]
Should probably work for you
Or try this:
RedirectMatch (.*)\.(gif|jpg|png)$ http://www.anotherserver.com$1.$2
精彩评论