Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 20EDE200A01 for ; Tue, 3 May 2016 17:26:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 203E51609F4; Tue, 3 May 2016 17:26:13 +0200 (CEST) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1CD661609A9 for ; Tue, 3 May 2016 17:26:11 +0200 (CEST) Received: (qmail 94772 invoked by uid 500); 3 May 2016 15:26:09 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 94762 invoked by uid 99); 3 May 2016 15:26:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2016 15:26:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id EB81B18028D for ; Tue, 3 May 2016 15:26:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.39 X-Spam-Level: * X-Spam-Status: No, score=1.39 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_DKIM_INVALID=0.01] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=neutral reason="invalid (public key: missing p= tag)" header.d=ymkatz.net Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id PmsYYolHH2Fj for ; Tue, 3 May 2016 15:26:06 +0000 (UTC) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 28C595F4EB for ; Tue, 3 May 2016 15:26:06 +0000 (UTC) Received: by mail-oi0-f41.google.com with SMTP id k142so30109747oib.1 for ; Tue, 03 May 2016 08:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymkatz.net; s=g; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=TSMHZnr2TNs1nc5zil2eP+AW7m38IQfQlGpeqNhJGpU=; b=haatasVQEuucsXxnK+09oL6YDjt6PGMVTN63QAi8s5J9pwKeLHAWFzNa+Hkir/apZ+ ylhQVbMLRM+C0rG0plBPFPAbun2XL600U+Q0O9gyFlBCZgUXV7crn5VlJ5izN1yqnzak j619ybJBc6ixgzIWilgPcnqIp02K62l5xjsgg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=TSMHZnr2TNs1nc5zil2eP+AW7m38IQfQlGpeqNhJGpU=; b=LGRuK6Z1Vffl1ytXXThddU4fc2uPNCOWwxqhNmfUAa1C/I7wpHVTZtZhOt1FwRVIVL dql1uzwkdcT5duLPINnOyVatCqJMJXBaFTqUpRvpjKZCSvcuYq5kHaFkKatIf7EwBkCS xj4jV4MkxHpAhkpfyYfDjBprrBiSvAEzUAn3ui/mGHL2W0F+d91sZ1xGkmvspwPqHZas CwjcHhHVeBp/ilPAMBD5erDUE/k0Cojt5IC+Mv7fQ+Gl4tHnCqnojruHaCBebcPhR1ip p3qUM8HD9ai3UxBIUGtkGzM2/xoH5C3R2DxfBf1UugKJ5sWyiFYDyiXx3p1PMDbcfmZQ TttQ== X-Gm-Message-State: AOPr4FXwX7aic1YWD2fkiA8mDyt7fA+nZWU0HdRPjAzoayuKdbSBn0JcAVvXc0/Pd2sm/UYc X-Received: by 10.202.50.6 with SMTP id y6mr1395171oiy.54.1462289159111; Tue, 03 May 2016 08:25:59 -0700 (PDT) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com. [209.85.218.45]) by smtp.gmail.com with ESMTPSA id a9sm1194740oet.13.2016.05.03.08.25.58 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 May 2016 08:25:58 -0700 (PDT) Received: by mail-oi0-f45.google.com with SMTP id k142so30109000oib.1 for ; Tue, 03 May 2016 08:25:58 -0700 (PDT) X-Received: by 10.157.47.69 with SMTP id h63mr1675640otb.2.1462289158246; Tue, 03 May 2016 08:25:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.215.212 with HTTP; Tue, 3 May 2016 08:25:38 -0700 (PDT) In-Reply-To: <5728888D020000D200060551@vgwmta.co.volusia.fl.us> References: <572882DB020000D200060547@vgwmta.co.volusia.fl.us> <5728888D020000D200060551@vgwmta.co.volusia.fl.us> From: Yehuda Katz Date: Tue, 3 May 2016 11:25:38 -0400 X-Gmail-Original-Message-ID: Message-ID: To: "users@httpd.apache.org" Content-Type: multipart/alternative; boundary=94eb2c030bf6d61acd0531f1b98f Subject: Re: [users@httpd] Show Alternate Image if Requested Image is Missing archived-at: Tue, 03 May 2016 15:26:13 -0000 --94eb2c030bf6d61acd0531f1b98f Content-Type: text/plain; charset=UTF-8 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 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 5/3/2016 11:02 AM >>> > On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa 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: > > > > > > 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 > > > > > > 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 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 > > --94eb2c030bf6d61acd0531f1b98f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The = images have to be accessible somehow: Just to clarify, you said:
- The DocumentRoot is "/mnt/data/pawebdata/docs&= quot;
- The images are located in=C2=A0= "/mnt/data/pawebdata/images&qu= ot;

Ho= w does the browser ever load any image? Is there an alias directive somewhe= re 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 i= nstead, 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
Rewrit= eRule \.(gif|jpe?g|png|bmp)$ /images/sketches/no_sketch.jpg [NC,L,R=3D302]= =C2=A0

- Y

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

I tried your suggested code already and have just retried it.=C2=A0 =C2=A0T= he 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 reference= s.

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.=C2=A0 I'm coming= in (inexperienced...but not dumb) with the assignment to show "no_ske= tch.jpg" for missing JPGs in the /image/sketches path and having to wo= rk with someone else's configuration.
So I'll try to give the best information I can.


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

>>> Yehuda Katz <ye= huda@ymkatz.net> 5/3/2016 11:02 AM >>>
On Tue, May 3, 2016 at 10:52 AM, Julie Ku= rpa <jkurpa@volusia.org> wr= ote:

> The sketches themselves are JPGs located within a directory on the Lin= ux
> 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.=C2=A0 =C2=A0 Here is what I have in my > vhosts.d/non-ssl.conf file for this step:
>
> <IfModule mod_rewrite.c>
>=C2=A0 RewriteEngine on
>=C2=A0 RewriteLog /var/log/apache2/rewrite.log
>=C2=A0 RewriteLogLevel 4
>=C2=A0 RewriteCond %{REQUEST_FILENAME} !-f
>=C2=A0 RewriteCond %{REQUEST_URI} "\.(gif|jpg|jpeg|png)$"
>=C2=A0 Redirect=C2=A0 .* http://pawebdev= 1.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 w= ant
this to work, you probably want the server to show an error if the rewrite<= br> 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


--94eb2c030bf6d61acd0531f1b98f--