Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-26-2005, 04:11 PM   #1
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
Quick htaccess question

Something I've never had to do before...

I need to pop up a standard 'no image available' image on a site whenever an image is broken. It has a huge database and manually digging out broken images to replace them would take hours.

Any ideas?
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-26-2005, 04:12 PM   #2
AlienQ - BANNED FOR LIFE
best designer on GFY
 
AlienQ - BANNED FOR LIFE's Avatar
 
Join Date: Mar 2003
Location: IALIEN.COM - High Definition Video and Photographic Productions -ICQ 78943384
Posts: 30,307
Use HTACCESS
AlienQ - BANNED FOR LIFE is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-26-2005, 04:13 PM   #3
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:06 AM   #4
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
Quick bump in case anyone knows. Not sure it's even possible though.
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:10 AM   #5
fusionx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Olongapo City, Philippines
Posts: 4,618
Quote:
Originally Posted by Tipsy
Quick bump in case anyone knows. Not sure it's even possible though.
I think you would be better off adding code to your script to check for the existence of the image, and replace it as needed. I don't think you can detect the missing image and have it be replaced using mod_rewrite in htaccess without opening the door to a whole bunch of other problems.
fusionx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:15 AM   #6
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
There's a way to do it with mod_rewrite. Give me a minute and I'll dig it up for you.
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:16 AM   #7
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
http://httpd.apache.org/docs/mod/mod...ml#RewriteCond

-f' (is regular file)
Treats the TestString as a pathname and tests if it exists and is a regular file.

You will probably find an example of it on this page:

http://httpd.apache.org/docs/misc/rewriteguide.html
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:19 AM   #8
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
Thanks I'll give it a go. If not then yep - looks like a script thing which'll keep me busy while I try to get my head back into php mode - it's been a while
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:20 AM   #9
Lycanthrope
Confirmed User
 
Lycanthrope's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Wisconsin
Posts: 4,517
Fusionx is probably right, but this should work:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.jpg$ /path/to/missing.jpg [L]

but be prepared for much more cpu usage
__________________
Lycanthrope is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:23 AM   #10
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
Quote:
Originally Posted by Lycanthrope
Fusionx is probably right, but this should work:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.jpg$ /path/to/missing.jpg [L]

but be prepared for much more cpu usage
Problem with that is it wants a fairly specific filename and they can vary hugely but thanks for the suggestion. I'll try the first idea in a bit and see how it goes
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:58 AM   #11
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
Quote:
Originally Posted by Lycanthrope
Fusionx is probably right, but this should work:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.jpg$ /path/to/missing.jpg [L]

but be prepared for much more cpu usage

Scrap the reply above. I replied without thinking or looking at the apache docs. It works more than fine and the CPU usage should be OK as it's a non-porn site so traffic is manageable Thanks.
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-27-2005, 09:59 AM   #12
Sosa
In Tushy Land
 
Sosa's Avatar
 
Join Date: Oct 2002
Location: Nebraska
Posts: 40,149
your fucking sig sucks ass.
Sosa is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.