PDA

View Full Version : htacces Question



doolbman
03-07-2008, 01:19 PM
I need to redirect any incoming request for any images to my image server
I know this will redirect any images to a single page on my server


RewriteEngine on
RewriteRule ^([a-z0-9]+).(jpe?g|gif|bmp|png)$ /testpicpage.php?uid=$1 [R]

and this will redirect to a single page to another page on a different server

Redirect Permanent /old-filename.php http://www.domain.com/new-filename.php

how do I put these together so that any images on my server gets redirect to http://www.myotherserver.com/imagecatch.php for example???

TrichomeKid
03-07-2008, 01:24 PM
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite\.com [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpeg|jpg|gif|bmp|png)$ /otherdirectory/hotlink.jpg [L]


I dunno if changing /otherdirectory/hotlink.jpg to a PHP will work or not

Edit: Probably won't since they'll most likely being using the image in an IMG tag...

awol
03-07-2008, 01:34 PM
Edit: Probably won't since they'll most likely being using the image in an IMG tag...


That shouldn't matter. As long as you return a Content-type: of an image, it will work properly.

doolbman
03-07-2008, 01:39 PM
thanks I got it to work

TrichomeKid
03-07-2008, 01:49 PM
That shouldn't matter. As long as you return a Content-type: of an image, it will work properly.

Tru dat

cit1
03-07-2008, 01:56 PM
Make sure you put two s's on the filename as well ;)