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
I want to redirect any image request that would result in a 404 to the remote server ie something like this:
^localpath(.*) http://otherhost/localpath$1
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)
edit This code works to redirect all 404's
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+) https://www.example.com/$1 [L]