You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Julie Kurpa <jk...@volusia.org> on 2016/05/03 16:52:11 UTC

[users@httpd] Show Alternate Image if Requested Image is Missing

I am trying to modify an Apache configuration in Suse Linux.   The website is used to view Property  and a mixture of html and cgi scripts. 

The cgi scripts query an oracle database and supply information to the screen, one of which, is a sketch of the property.

The sketches themselves are JPGs located within a directory on the Linux server.

Some properties may be missing their JPG sketch and a 404 gets logged in the apache error_log.   

If the JPG for a property is found to be missing, I would like to show an alternate JPG called "no_sketch.jpg".

I've been trying various combinations of the Rewrite module that I've found in both Apache support forums and others.   

So far, the closest I've gotten it to work is for the "no_sketch.jpg" to show for every image, rather than just the one missing. 

A summary of the configuration is as follows:

An httpd.conf file that references a vhosts.d directory that contains two config files depending on the method of using either non-ssl or ssl.

I'm testing with the non-ssl approach and so only working with the vhosts.d/non-ssl.conf file.  

When the JPG is not found, it displays the following in the error_log:

[Tue May 03 09:38:23 2016] [error] [client 172.30.29.19] File does not exist: /mnt/data/pawebdata/images/sketches/82989.jpg, referer: http://pawebdev1.vcgov.org/cgi-bin/search.cgi 

I've added a section in the vhosts.d/non-ssl.conf file to handle the redirection but no joy so far.  It either doesn't work at all or it replaces all jpg files with the "no_sketch.jpg" file.  
I've tried a gazillion variations of the RewriteRule and am now trying the Redirect.  

I'm completely at a loss.    Here is what I have in my vhosts.d/non-ssl.conf file for this step:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteLog /var/log/apache2/rewrite.log
 RewriteLogLevel 4
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
 Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg 
</IfModule>


Here is a snippet from the rewrite.log that deals with the particular missing jpg called "82989.jpg".  

172.30.29.19 - - [03/May/2016:10:03:15 --0400] [pawebdev1.vcgov.org/sid#7fa11b67ab60][rid#7fa11b78ccc8/initial] (2) init rewrite engine with requested uri /cgi-bin/search.cgi
172.30.29.19 - - [03/May/2016:10:03:15 --0400] [pawebdev1.vcgov.org/sid#7fa11b67ab60][rid#7fa11b78ccc8/initial] (1) pass through /cgi-bin/search.cgi
172.30.29.19 - - [03/May/2016:10:03:15 --0400] [pawebdev1.vcgov.org/sid#7fa11b67ab60][rid#7fa11b788ca8/initial] (2) init rewrite engine with requested uri /images/sketches/82989.jpg
172.30.29.19 - - [03/May/2016:10:03:15 --0400] [pawebdev1.vcgov.org/sid#7fa11b67ab60][rid#7fa11b788ca8/initial] (1) pass through /images/sketches/82989.jpg
172.30.29.19 - - [03/May/2016:10:03:15 --0400] [pawebdev1.vcgov.org/sid#7fa11b67ab60][rid#7fa11b78dd98/initial/redir#1] (2) init rewrite engine with requested uri /404.html
172.30.29.19 - - [03/May/2016:10:03:15 --0400] [pawebdev1.vcgov.org/sid#7fa11b67ab60][rid#7fa11b78dd98/initial/redir#1] (1) pass through /404.html
172.30.29.19 - - [03/May/2016:10:03:18 --0400] [pawebdev1.vcgov.org/sid#7fa11b67ab60][rid#7fa11b788ca8/initial] (2) init rewrite engine with requested uri /cgi-bin/search.cgi



Julie Kurpa
Sr. Systems Programmer
  119 W. Indiana Ave
  DeLand, FL  32720
  Office:  (386) 736-5960 x12875


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Julie Kurpa <jk...@volusia.org>.
I can appreciate that Nick.   Can you provide further guidance?

I see that there is a ErrorDocument 404 /404.html

But I don't know what you suggest I do with this.   For pages that are missing, I'd like the 404.html to show.   For an image within a page, I'd like the "no_sketch.jpg" to show.  

Julie Kurpa
Sr. Systems Programmer
  119 W. Indiana Ave
  DeLand, FL  32720
  Office:  (386) 736-5960 x12875

>>> Nick Kew <ni...@webthing.com> 5/3/2016 10:57 AM >>>
On Tue, 2016-05-03 at 10:52 -0400, Julie Kurpa wrote:

> I've been trying various combinations of the Rewrite module 

Bad idea.  Don't go looking for the brittle and difficult solution
until you've looked for an easy one.

In your case, ErrorDocument.

-- 
Nick Kew


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
For additional commands, e-mail: users-help@httpd.apache.org 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 2016-05-03 at 10:52 -0400, Julie Kurpa wrote:

> I've been trying various combinations of the Rewrite module 

Bad idea.  Don't go looking for the brittle and difficult solution
until you've looked for an easy one.

In your case, ErrorDocument.

-- 
Nick Kew


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Julie Kurpa <jk...@volusia.org>.
BTW, Here is a snippet from the rewrite log:

172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba7ce8/initial] (2) init rewrite engine with requested uri /images/sRegion.png
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba7ce8/initial] (3) applying pattern '\\.(gif|jpe?g|png|bmp)$' to uri '/images/sRegion.png'
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba7ce8/initial] (4) RewriteCond: input='/images/sRegion.png' pattern='!-f' => matched
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba7ce8/initial] (2) rewrite '/images/sRegion.png' -> '/images/sketches/no_sketch.jpg'
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba7ce8/initial] (2) local path result: /images/sketches/no_sketch.jpg
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba7ce8/initial] (2) prefixed with document_root to /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba7ce8/initial] (1) go-ahead with /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg [OK]
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba3d10/initial/redir#1] (2) init rewrite engine with requested uri /404.html
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba3d10/initial/redir#1] (3) applying pattern '\\.(gif|jpe?g|png|bmp)$' to uri '/404.html'
172.30.29.19 - - [03/May/2016:11:07:56 --0400] [pawebdev1.vcgov.org/sid#7f47d6a93b60][rid#7f47d6ba3d10/initial/redir#1] (1) pass through /404.html

Julie Kurpa
Sr. Systems Programmer
  119 W. Indiana Ave
  DeLand, FL  32720
  Office:  (386) 736-5960 x12875

>>> "Julie Kurpa" <jk...@volusia.org> 5/3/2016 11:16 AM >>>
Thanks Yehuda,

I tried your suggested code already and have just retried it.   The behavior is that all jpg's are now not showing at all.    

From what I tell from the rewrite.log, it is pasting the DocumentRoot path in front of the path to the "no_sketch.jpg" for all JPG references.  

The DocumentRoot is "/mnt/data/pawebdata/docs"

Here's what the log shows is being used for the path to "no_sketch.jpg"

/mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg

Note that I did not configure this Apache environment.  I'm coming in (inexperienced...but not dumb) with the assignment to show "no_sketch.jpg" for missing JPGs in the /image/sketches path and having to work with someone else's configuration. 
So I'll try to give the best information I can. 


Julie Kurpa
Sr. Systems Programmer
  119 W. Indiana Ave
  DeLand, FL  32720
  Office:  (386) 736-5960 x12875

>>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:

> The sketches themselves are JPGs located within a directory on the Linux
> server.
> If the JPG for a property is found to be missing, I would like to show an
> alternate JPG called "no_sketch.jpg".
>


I've tried a gazillion variations of the RewriteRule and am now trying the
> Redirect.
>
> I'm completely at a loss.    Here is what I have in my
> vhosts.d/non-ssl.conf file for this step:
>
> <IfModule mod_rewrite.c>
>  RewriteEngine on
>  RewriteLog /var/log/apache2/rewrite.log
>  RewriteLogLevel 4
>  RewriteCond %{REQUEST_FILENAME} !-f
>  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
>  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg 
> </IfModule>
>

You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
Something like the following should be enough:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]

I also usually recommend not using the <IfModule> directive. If you want
this to work, you probably want the server to show an error if the rewrite
module isn't loaded rather than ignore the configuration.

- Y


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
For additional commands, e-mail: users-help@httpd.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Julie Kurpa <jk...@volusia.org>.
It's possible I've just gotten it to work.  Still testing but this is very promising....

I found a blogger who gave code on how to do this.  http://drincruz.blogspot.com/2009/05/apache-redirecting-missing-images-with.html

Since I was already getting the DocumetRoot in the path, I decided to hardcode the path to the images and ended up with the following that is working:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond "/mnt/data/pawebdata/%{REQUEST_URI}" !-f
 RewriteRule \.(gif|jpe?g|png|bmp)$ "/mnt/data/pawebdata/images/sketches/no_sketch.jpg" [NC,L]
</IfModule>

Log snippet looks like this:

172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c3fc58/initial] (2) init rewrite engine with requested uri /images/sRegion-Body.png
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c3fc58/initial] (3) applying pattern '\\.(gif|jpe?g|png|bmp)$' to uri '/images/sRegion-Body.png'
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c3fc58/initial] (4) RewriteCond: input='/mnt/data/pawebdata//images/sRegion-Body.png' pattern='!-f' => not-matched
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c3fc58/initial] (1) pass through /images/sRegion-Body.png
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c43c78/initial] (2) init rewrite engine with requested uri /images/sketches/82989.jpg
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c43c78/initial] (3) applying pattern '\\.(gif|jpe?g|png|bmp)$' to uri '/images/sketches/82989.jpg'
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c43c78/initial] (4) RewriteCond: input='/mnt/data/pawebdata//images/sketches/82989.jpg' pattern='!-f' => matched
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c43c78/initial] (2) rewrite '/images/sketches/82989.jpg' -> '/mnt/data/pawebdata/images/sketches/no_sketch.jpg'
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c43c78/initial] (2) local path result: /mnt/data/pawebdata/images/sketches/no_sketch.jpg
172.30.29.19 - - [03/May/2016:12:16:49 --0400] [pawebdev1.vcgov.org/sid#7fb094b31b60][rid#7fb094c43c78/initial] (1) go-ahead with /mnt/data/pawebdata/images/sketches/no_sketch.jpg [OK]


Will still try some tweaks to avoid coding the full path but at least it's working.  I've spent over a week on this. 



Julie Kurpa


>>> "Julie Kurpa" <jk...@volusia.org> 5/3/2016 11:52 AM >>>
Yes.  Do you want a snippet or the whole thing?  Size  442 KB.

I'm new to this forum, do I just attach it to the reply email?

Julie Kurpa


>>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:45 AM >>>
Do you have logs from either of those?

- Y


On Tue, May 3, 2016 at 11:44 AM, Julie Kurpa <jk...@volusia.org> wrote:

> I put the "no_sketch.jpg" image in path
> "/mnt/data/pawebdata/docs/images/sketches" and indeed, every jpg showed the
> "no_sketch.jpg" image.
>
> The 302 didn't seem to do anything.
>
> Julie Kurpa
>
>
> >>> "Julie Kurpa" <jk...@volusia.org> 5/3/2016 11:34 AM >>>
> Yes there is an alias for the images specified in the vhosts.conf file.
> :)
>
> Alias /images/ /mnt/data/pawebdata/images/
>  <Directory /mnt/data/pawebdata/images>
>   AllowOverride None
>   Order allow,deny
>   Allow from all
>  </Directory>
>
> I can create the directory path "/mnt/data/pawebdata/docs/images/sketches"
> just to see if the "no_sketch.jpg" shows. But that couldn't be the
> permanent solution.
>
> I will also try the 302 thing.
>
>
>
> Julie Kurpa
>
>
> >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:25 AM >>>
> The images have to be accessible somehow: Just to clarify, you said:
> - The DocumentRoot is "/mnt/data/pawebdata/docs"
> - The images are located in "/mnt/data/pawebdata/images"
>
> How does the browser ever load any image? Is there an alias directive
> somewhere in the configuration?
>
> Can you put the image at
> /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg and see if it works?
>
> You could try an external redirect instead, but I haven't tested that
> myself.
> I recommend making it a temporary redirect (302) rather than permanent
> (301):
>
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg
> [NC,L,R=302]
>
> - Y
>
> On Tue, May 3, 2016 at 11:16 AM, Julie Kurpa <jk...@volusia.org> wrote:
>
> > Thanks Yehuda,
> >
> > I tried your suggested code already and have just retried it.   The
> > behavior is that all jpg's are now not showing at all.
> >
> > From what I tell from the rewrite.log, it is pasting the DocumentRoot
> path
> > in front of the path to the "no_sketch.jpg" for all JPG references.
> >
> > The DocumentRoot is "/mnt/data/pawebdata/docs"
> >
> > Here's what the log shows is being used for the path to "no_sketch.jpg"
> >
> > /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg
> >
> > Note that I did not configure this Apache environment.  I'm coming in
> > (inexperienced...but not dumb) with the assignment to show
> "no_sketch.jpg"
> > for missing JPGs in the /image/sketches path and having to work with
> > someone else's configuration.
> > So I'll try to give the best information I can.
> >
> >
> > Julie Kurpa
> > Sr. Systems Programmer
> >   119 W. Indiana Ave
> >   DeLand, FL  32720
> >   Office:  (386) 736-5960 x12875
> >
> > >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
> > On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:
> >
> > > The sketches themselves are JPGs located within a directory on the
> Linux
> > > server.
> > > If the JPG for a property is found to be missing, I would like to show
> an
> > > alternate JPG called "no_sketch.jpg".
> > >
> >
> >
> > I've tried a gazillion variations of the RewriteRule and am now trying
> the
> > > Redirect.
> > >
> > > I'm completely at a loss.    Here is what I have in my
> > > vhosts.d/non-ssl.conf file for this step:
> > >
> > > <IfModule mod_rewrite.c>
> > >  RewriteEngine on
> > >  RewriteLog /var/log/apache2/rewrite.log
> > >  RewriteLogLevel 4
> > >  RewriteCond %{REQUEST_FILENAME} !-f
> > >  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
> > >  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg 
> > > </IfModule>
> > >
> >
> > You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
> > Something like the following should be enough:
> >
> > RewriteEngine on
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]
> >
> > I also usually recommend not using the <IfModule> directive. If you want
> > this to work, you probably want the server to show an error if the
> rewrite
> > module isn't loaded rather than ignore the configuration.
> >
> > - Y
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> > For additional commands, e-mail: users-help@httpd.apache.org 
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> For additional commands, e-mail: users-help@httpd.apache.org 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> For additional commands, e-mail: users-help@httpd.apache.org 
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
For additional commands, e-mail: users-help@httpd.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Julie Kurpa <jk...@volusia.org>.
Yes.  Do you want a snippet or the whole thing?  Size  442 KB.

I'm new to this forum, do I just attach it to the reply email?

Julie Kurpa


>>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:45 AM >>>
Do you have logs from either of those?

- Y


On Tue, May 3, 2016 at 11:44 AM, Julie Kurpa <jk...@volusia.org> wrote:

> I put the "no_sketch.jpg" image in path
> "/mnt/data/pawebdata/docs/images/sketches" and indeed, every jpg showed the
> "no_sketch.jpg" image.
>
> The 302 didn't seem to do anything.
>
> Julie Kurpa
>
>
> >>> "Julie Kurpa" <jk...@volusia.org> 5/3/2016 11:34 AM >>>
> Yes there is an alias for the images specified in the vhosts.conf file.
> :)
>
> Alias /images/ /mnt/data/pawebdata/images/
>  <Directory /mnt/data/pawebdata/images>
>   AllowOverride None
>   Order allow,deny
>   Allow from all
>  </Directory>
>
> I can create the directory path "/mnt/data/pawebdata/docs/images/sketches"
> just to see if the "no_sketch.jpg" shows. But that couldn't be the
> permanent solution.
>
> I will also try the 302 thing.
>
>
>
> Julie Kurpa
>
>
> >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:25 AM >>>
> The images have to be accessible somehow: Just to clarify, you said:
> - The DocumentRoot is "/mnt/data/pawebdata/docs"
> - The images are located in "/mnt/data/pawebdata/images"
>
> How does the browser ever load any image? Is there an alias directive
> somewhere in the configuration?
>
> Can you put the image at
> /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg and see if it works?
>
> You could try an external redirect instead, but I haven't tested that
> myself.
> I recommend making it a temporary redirect (302) rather than permanent
> (301):
>
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg
> [NC,L,R=302]
>
> - Y
>
> On Tue, May 3, 2016 at 11:16 AM, Julie Kurpa <jk...@volusia.org> wrote:
>
> > Thanks Yehuda,
> >
> > I tried your suggested code already and have just retried it.   The
> > behavior is that all jpg's are now not showing at all.
> >
> > From what I tell from the rewrite.log, it is pasting the DocumentRoot
> path
> > in front of the path to the "no_sketch.jpg" for all JPG references.
> >
> > The DocumentRoot is "/mnt/data/pawebdata/docs"
> >
> > Here's what the log shows is being used for the path to "no_sketch.jpg"
> >
> > /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg
> >
> > Note that I did not configure this Apache environment.  I'm coming in
> > (inexperienced...but not dumb) with the assignment to show
> "no_sketch.jpg"
> > for missing JPGs in the /image/sketches path and having to work with
> > someone else's configuration.
> > So I'll try to give the best information I can.
> >
> >
> > Julie Kurpa
> > Sr. Systems Programmer
> >   119 W. Indiana Ave
> >   DeLand, FL  32720
> >   Office:  (386) 736-5960 x12875
> >
> > >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
> > On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:
> >
> > > The sketches themselves are JPGs located within a directory on the
> Linux
> > > server.
> > > If the JPG for a property is found to be missing, I would like to show
> an
> > > alternate JPG called "no_sketch.jpg".
> > >
> >
> >
> > I've tried a gazillion variations of the RewriteRule and am now trying
> the
> > > Redirect.
> > >
> > > I'm completely at a loss.    Here is what I have in my
> > > vhosts.d/non-ssl.conf file for this step:
> > >
> > > <IfModule mod_rewrite.c>
> > >  RewriteEngine on
> > >  RewriteLog /var/log/apache2/rewrite.log
> > >  RewriteLogLevel 4
> > >  RewriteCond %{REQUEST_FILENAME} !-f
> > >  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
> > >  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg 
> > > </IfModule>
> > >
> >
> > You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
> > Something like the following should be enough:
> >
> > RewriteEngine on
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]
> >
> > I also usually recommend not using the <IfModule> directive. If you want
> > this to work, you probably want the server to show an error if the
> rewrite
> > module isn't loaded rather than ignore the configuration.
> >
> > - Y
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> > For additional commands, e-mail: users-help@httpd.apache.org 
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> For additional commands, e-mail: users-help@httpd.apache.org 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> For additional commands, e-mail: users-help@httpd.apache.org 
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Yehuda Katz <ye...@ymkatz.net>.
Do you have logs from either of those?

- Y


On Tue, May 3, 2016 at 11:44 AM, Julie Kurpa <jk...@volusia.org> wrote:

> I put the "no_sketch.jpg" image in path
> "/mnt/data/pawebdata/docs/images/sketches" and indeed, every jpg showed the
> "no_sketch.jpg" image.
>
> The 302 didn't seem to do anything.
>
> Julie Kurpa
>
>
> >>> "Julie Kurpa" <jk...@volusia.org> 5/3/2016 11:34 AM >>>
> Yes there is an alias for the images specified in the vhosts.conf file.
> :)
>
> Alias /images/ /mnt/data/pawebdata/images/
>  <Directory /mnt/data/pawebdata/images>
>   AllowOverride None
>   Order allow,deny
>   Allow from all
>  </Directory>
>
> I can create the directory path "/mnt/data/pawebdata/docs/images/sketches"
> just to see if the "no_sketch.jpg" shows. But that couldn't be the
> permanent solution.
>
> I will also try the 302 thing.
>
>
>
> Julie Kurpa
>
>
> >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:25 AM >>>
> The images have to be accessible somehow: Just to clarify, you said:
> - The DocumentRoot is "/mnt/data/pawebdata/docs"
> - The images are located in "/mnt/data/pawebdata/images"
>
> How does the browser ever load any image? Is there an alias directive
> somewhere in the configuration?
>
> Can you put the image at
> /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg and see if it works?
>
> You could try an external redirect instead, but I haven't tested that
> myself.
> I recommend making it a temporary redirect (302) rather than permanent
> (301):
>
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg
> [NC,L,R=302]
>
> - Y
>
> On Tue, May 3, 2016 at 11:16 AM, Julie Kurpa <jk...@volusia.org> wrote:
>
> > Thanks Yehuda,
> >
> > I tried your suggested code already and have just retried it.   The
> > behavior is that all jpg's are now not showing at all.
> >
> > From what I tell from the rewrite.log, it is pasting the DocumentRoot
> path
> > in front of the path to the "no_sketch.jpg" for all JPG references.
> >
> > The DocumentRoot is "/mnt/data/pawebdata/docs"
> >
> > Here's what the log shows is being used for the path to "no_sketch.jpg"
> >
> > /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg
> >
> > Note that I did not configure this Apache environment.  I'm coming in
> > (inexperienced...but not dumb) with the assignment to show
> "no_sketch.jpg"
> > for missing JPGs in the /image/sketches path and having to work with
> > someone else's configuration.
> > So I'll try to give the best information I can.
> >
> >
> > Julie Kurpa
> > Sr. Systems Programmer
> >   119 W. Indiana Ave
> >   DeLand, FL  32720
> >   Office:  (386) 736-5960 x12875
> >
> > >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
> > On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:
> >
> > > The sketches themselves are JPGs located within a directory on the
> Linux
> > > server.
> > > If the JPG for a property is found to be missing, I would like to show
> an
> > > alternate JPG called "no_sketch.jpg".
> > >
> >
> >
> > I've tried a gazillion variations of the RewriteRule and am now trying
> the
> > > Redirect.
> > >
> > > I'm completely at a loss.    Here is what I have in my
> > > vhosts.d/non-ssl.conf file for this step:
> > >
> > > <IfModule mod_rewrite.c>
> > >  RewriteEngine on
> > >  RewriteLog /var/log/apache2/rewrite.log
> > >  RewriteLogLevel 4
> > >  RewriteCond %{REQUEST_FILENAME} !-f
> > >  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
> > >  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg
> > > </IfModule>
> > >
> >
> > You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
> > Something like the following should be enough:
> >
> > RewriteEngine on
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]
> >
> > I also usually recommend not using the <IfModule> directive. If you want
> > this to work, you probably want the server to show an error if the
> rewrite
> > module isn't loaded rather than ignore the configuration.
> >
> > - Y
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Julie Kurpa <jk...@volusia.org>.
I put the "no_sketch.jpg" image in path  "/mnt/data/pawebdata/docs/images/sketches" and indeed, every jpg showed the "no_sketch.jpg" image.  

The 302 didn't seem to do anything.  

Julie Kurpa


>>> "Julie Kurpa" <jk...@volusia.org> 5/3/2016 11:34 AM >>>
Yes there is an alias for the images specified in the vhosts.conf file.    :)

Alias /images/ /mnt/data/pawebdata/images/
 <Directory /mnt/data/pawebdata/images>
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

I can create the directory path "/mnt/data/pawebdata/docs/images/sketches" just to see if the "no_sketch.jpg" shows. But that couldn't be the permanent solution.  

I will also try the 302 thing. 



Julie Kurpa


>>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:25 AM >>>
The images have to be accessible somehow: Just to clarify, you said:
- The DocumentRoot is "/mnt/data/pawebdata/docs"
- The images are located in "/mnt/data/pawebdata/images"

How does the browser ever load any image? Is there an alias directive
somewhere in the configuration?

Can you put the image at
/mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg and see if it works?

You could try an external redirect instead, but I haven't tested that
myself.
I recommend making it a temporary redirect (302) rather than permanent
(301):

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg
[NC,L,R=302]

- Y

On Tue, May 3, 2016 at 11:16 AM, Julie Kurpa <jk...@volusia.org> wrote:

> Thanks Yehuda,
>
> I tried your suggested code already and have just retried it.   The
> behavior is that all jpg's are now not showing at all.
>
> From what I tell from the rewrite.log, it is pasting the DocumentRoot path
> in front of the path to the "no_sketch.jpg" for all JPG references.
>
> The DocumentRoot is "/mnt/data/pawebdata/docs"
>
> Here's what the log shows is being used for the path to "no_sketch.jpg"
>
> /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg
>
> Note that I did not configure this Apache environment.  I'm coming in
> (inexperienced...but not dumb) with the assignment to show "no_sketch.jpg"
> for missing JPGs in the /image/sketches path and having to work with
> someone else's configuration.
> So I'll try to give the best information I can.
>
>
> Julie Kurpa
> Sr. Systems Programmer
>   119 W. Indiana Ave
>   DeLand, FL  32720
>   Office:  (386) 736-5960 x12875
>
> >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
> On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:
>
> > The sketches themselves are JPGs located within a directory on the Linux
> > server.
> > If the JPG for a property is found to be missing, I would like to show an
> > alternate JPG called "no_sketch.jpg".
> >
>
>
> I've tried a gazillion variations of the RewriteRule and am now trying the
> > Redirect.
> >
> > I'm completely at a loss.    Here is what I have in my
> > vhosts.d/non-ssl.conf file for this step:
> >
> > <IfModule mod_rewrite.c>
> >  RewriteEngine on
> >  RewriteLog /var/log/apache2/rewrite.log
> >  RewriteLogLevel 4
> >  RewriteCond %{REQUEST_FILENAME} !-f
> >  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
> >  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg 
> > </IfModule>
> >
>
> You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
> Something like the following should be enough:
>
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]
>
> I also usually recommend not using the <IfModule> directive. If you want
> this to work, you probably want the server to show an error if the rewrite
> module isn't loaded rather than ignore the configuration.
>
> - Y
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> For additional commands, e-mail: users-help@httpd.apache.org 
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
For additional commands, e-mail: users-help@httpd.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Julie Kurpa <jk...@volusia.org>.
Yes there is an alias for the images specified in the vhosts.conf file.    :)

Alias /images/ /mnt/data/pawebdata/images/
 <Directory /mnt/data/pawebdata/images>
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

I can create the directory path "/mnt/data/pawebdata/docs/images/sketches" just to see if the "no_sketch.jpg" shows. But that couldn't be the permanent solution.  

I will also try the 302 thing. 



Julie Kurpa


>>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:25 AM >>>
The images have to be accessible somehow: Just to clarify, you said:
- The DocumentRoot is "/mnt/data/pawebdata/docs"
- The images are located in "/mnt/data/pawebdata/images"

How does the browser ever load any image? Is there an alias directive
somewhere in the configuration?

Can you put the image at
/mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg and see if it works?

You could try an external redirect instead, but I haven't tested that
myself.
I recommend making it a temporary redirect (302) rather than permanent
(301):

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg
[NC,L,R=302]

- Y

On Tue, May 3, 2016 at 11:16 AM, Julie Kurpa <jk...@volusia.org> wrote:

> Thanks Yehuda,
>
> I tried your suggested code already and have just retried it.   The
> behavior is that all jpg's are now not showing at all.
>
> From what I tell from the rewrite.log, it is pasting the DocumentRoot path
> in front of the path to the "no_sketch.jpg" for all JPG references.
>
> The DocumentRoot is "/mnt/data/pawebdata/docs"
>
> Here's what the log shows is being used for the path to "no_sketch.jpg"
>
> /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg
>
> Note that I did not configure this Apache environment.  I'm coming in
> (inexperienced...but not dumb) with the assignment to show "no_sketch.jpg"
> for missing JPGs in the /image/sketches path and having to work with
> someone else's configuration.
> So I'll try to give the best information I can.
>
>
> Julie Kurpa
> Sr. Systems Programmer
>   119 W. Indiana Ave
>   DeLand, FL  32720
>   Office:  (386) 736-5960 x12875
>
> >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
> On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:
>
> > The sketches themselves are JPGs located within a directory on the Linux
> > server.
> > If the JPG for a property is found to be missing, I would like to show an
> > alternate JPG called "no_sketch.jpg".
> >
>
>
> I've tried a gazillion variations of the RewriteRule and am now trying the
> > Redirect.
> >
> > I'm completely at a loss.    Here is what I have in my
> > vhosts.d/non-ssl.conf file for this step:
> >
> > <IfModule mod_rewrite.c>
> >  RewriteEngine on
> >  RewriteLog /var/log/apache2/rewrite.log
> >  RewriteLogLevel 4
> >  RewriteCond %{REQUEST_FILENAME} !-f
> >  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
> >  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg 
> > </IfModule>
> >
>
> You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
> Something like the following should be enough:
>
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]
>
> I also usually recommend not using the <IfModule> directive. If you want
> this to work, you probably want the server to show an error if the rewrite
> module isn't loaded rather than ignore the configuration.
>
> - Y
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
> For additional commands, e-mail: users-help@httpd.apache.org 
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Yehuda Katz <ye...@ymkatz.net>.
The images have to be accessible somehow: Just to clarify, you said:
- The DocumentRoot is "/mnt/data/pawebdata/docs"
- The images are located in "/mnt/data/pawebdata/images"

How does the browser ever load any image? Is there an alias directive
somewhere in the configuration?

Can you put the image at
/mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg and see if it works?

You could try an external redirect instead, but I haven't tested that
myself.
I recommend making it a temporary redirect (302) rather than permanent
(301):

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg
[NC,L,R=302]

- Y

On Tue, May 3, 2016 at 11:16 AM, Julie Kurpa <jk...@volusia.org> wrote:

> Thanks Yehuda,
>
> I tried your suggested code already and have just retried it.   The
> behavior is that all jpg's are now not showing at all.
>
> From what I tell from the rewrite.log, it is pasting the DocumentRoot path
> in front of the path to the "no_sketch.jpg" for all JPG references.
>
> The DocumentRoot is "/mnt/data/pawebdata/docs"
>
> Here's what the log shows is being used for the path to "no_sketch.jpg"
>
> /mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg
>
> Note that I did not configure this Apache environment.  I'm coming in
> (inexperienced...but not dumb) with the assignment to show "no_sketch.jpg"
> for missing JPGs in the /image/sketches path and having to work with
> someone else's configuration.
> So I'll try to give the best information I can.
>
>
> Julie Kurpa
> Sr. Systems Programmer
>   119 W. Indiana Ave
>   DeLand, FL  32720
>   Office:  (386) 736-5960 x12875
>
> >>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
> On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:
>
> > The sketches themselves are JPGs located within a directory on the Linux
> > server.
> > If the JPG for a property is found to be missing, I would like to show an
> > alternate JPG called "no_sketch.jpg".
> >
>
>
> I've tried a gazillion variations of the RewriteRule and am now trying the
> > Redirect.
> >
> > I'm completely at a loss.    Here is what I have in my
> > vhosts.d/non-ssl.conf file for this step:
> >
> > <IfModule mod_rewrite.c>
> >  RewriteEngine on
> >  RewriteLog /var/log/apache2/rewrite.log
> >  RewriteLogLevel 4
> >  RewriteCond %{REQUEST_FILENAME} !-f
> >  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
> >  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg
> > </IfModule>
> >
>
> You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
> Something like the following should be enough:
>
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]
>
> I also usually recommend not using the <IfModule> directive. If you want
> this to work, you probably want the server to show an error if the rewrite
> module isn't loaded rather than ignore the configuration.
>
> - Y
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Julie Kurpa <jk...@volusia.org>.
Thanks Yehuda,

I tried your suggested code already and have just retried it.   The behavior is that all jpg's are now not showing at all.    

From what I tell from the rewrite.log, it is pasting the DocumentRoot path in front of the path to the "no_sketch.jpg" for all JPG references.  

The DocumentRoot is "/mnt/data/pawebdata/docs"

Here's what the log shows is being used for the path to "no_sketch.jpg"

/mnt/data/pawebdata/docs/images/sketches/no_sketch.jpg

Note that I did not configure this Apache environment.  I'm coming in (inexperienced...but not dumb) with the assignment to show "no_sketch.jpg" for missing JPGs in the /image/sketches path and having to work with someone else's configuration. 
So I'll try to give the best information I can. 


Julie Kurpa
Sr. Systems Programmer
  119 W. Indiana Ave
  DeLand, FL  32720
  Office:  (386) 736-5960 x12875

>>> Yehuda Katz <ye...@ymkatz.net> 5/3/2016 11:02 AM >>>
On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:

> The sketches themselves are JPGs located within a directory on the Linux
> server.
> If the JPG for a property is found to be missing, I would like to show an
> alternate JPG called "no_sketch.jpg".
>


I've tried a gazillion variations of the RewriteRule and am now trying the
> Redirect.
>
> I'm completely at a loss.    Here is what I have in my
> vhosts.d/non-ssl.conf file for this step:
>
> <IfModule mod_rewrite.c>
>  RewriteEngine on
>  RewriteLog /var/log/apache2/rewrite.log
>  RewriteLogLevel 4
>  RewriteCond %{REQUEST_FILENAME} !-f
>  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
>  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg 
> </IfModule>
>

You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
Something like the following should be enough:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]

I also usually recommend not using the <IfModule> directive. If you want
this to work, you probably want the server to show an error if the rewrite
module isn't loaded rather than ignore the configuration.

- Y


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Show Alternate Image if Requested Image is Missing

Posted by Yehuda Katz <ye...@ymkatz.net>.
On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jk...@volusia.org> wrote:

> The sketches themselves are JPGs located within a directory on the Linux
> server.
> If the JPG for a property is found to be missing, I would like to show an
> alternate JPG called "no_sketch.jpg".
>


I've tried a gazillion variations of the RewriteRule and am now trying the
> Redirect.
>
> I'm completely at a loss.    Here is what I have in my
> vhosts.d/non-ssl.conf file for this step:
>
> <IfModule mod_rewrite.c>
>  RewriteEngine on
>  RewriteLog /var/log/apache2/rewrite.log
>  RewriteLogLevel 4
>  RewriteCond %{REQUEST_FILENAME} !-f
>  RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
>  Redirect  .* http://pawebdev1.vcgov.org/images/sketches/no_sketch.jpg
> </IfModule>
>

You need to use RewriteRule, Redirect has nothing to do with RewriteCond.
Something like the following should be enough:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L]

I also usually recommend not using the <IfModule> directive. If you want
this to work, you probably want the server to show an error if the rewrite
module isn't loaded rather than ignore the configuration.

- Y