GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Quick htaccess question (https://gfy.com/showthread.php?t=437355)

Tipsy 02-26-2005 04:11 PM

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?

AlienQ - BANNED FOR LIFE 02-26-2005 04:12 PM

Use HTACCESS:)

Tipsy 02-26-2005 04:13 PM

:upsidedow

Tipsy 02-27-2005 09:06 AM

Quick bump in case anyone knows. Not sure it's even possible though.

fusionx 02-27-2005 09:10 AM

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.

swedguy 02-27-2005 09:15 AM

There's a way to do it with mod_rewrite. Give me a minute and I'll dig it up for you.

swedguy 02-27-2005 09:16 AM

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

Tipsy 02-27-2005 09:19 AM

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 :)

Lycanthrope 02-27-2005 09:20 AM

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

Tipsy 02-27-2005 09:23 AM

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 :)

Tipsy 02-27-2005 09:58 AM

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.

Sosa 02-27-2005 09:59 AM

your fucking sig sucks ass.


All times are GMT -7. The time now is 04:22 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123