modrewrite to another server if file/image is not found
Posted
by
Traveling_Monk
on Stack Overflow
See other posts from Stack Overflow
or by Traveling_Monk
Published on 2011-02-26T23:23:08Z
Indexed on
2011/02/26
23:24 UTC
Read the original article
Hit count: 201
Hi I am working on a locally served copy of a remote site and I don't want to have to download all the images rtelated to the site so I thought i could come up with a mod_rewrite rule for to grab images from the remote server if the are not found this is the code that i have
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [NC]
RewriteRule ^/(.*\.(png|gif|jpg|jpeg)) https://www.exmple.com/$1 [NC,P,L]
</IfModule>
The page is still giving me 404's for images that are on the remote server, so this rule is not working.
I do know that the htaccess is being processed because rules later in the IfModule mod_rewrite.c block are being used. (i simplified my code sample but this is the first rule in the IfModule mod_rewrite.c block)
© Stack Overflow or respective owner