Re: Show Alternate Image if Requested Image is Missing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 3, 2016 at 10:52 AM, Julie Kurpa <jkurpa@xxxxxxxxxxx> 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

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux