Hi everybody,
actually I'm trying to pass referers inside the .htaccess. What I'm trying to do is that the referer value shall be send to a PHP script where this value will be saved to a databse. In some cases (depending on the referer) the image shall be blocked (hot linking) and in some other cases the image shall be shown normally. But it will not work :-( My current "try" looks like the following (it is just for testing, so currently every image will be handled):
RewriteCond %{REQUEST_URI} (.*)jpg$
RewriteCond %{ENV:verified} ^$
RewriteRule (.*)jpg$ /include/referrer.php?ref=%{REQUEST_FILENAME}&uri=%{REQUEST_URI}&query=%{QUERY_STRING}&env=%{ENV:verified} [E=verified:yes]
RewriteCond %{REQUEST_URI} (.*)jpg$
RewriteCond %{ENV:verified} ^yes$
RewriteRule ^(.*)$ %{REQUEST_FILENAME} [E=verified:no]
The referrer.php look like:
<?
log_img($_REQUEST['uri'].' - "'.$_REQUEST['env'].'"');
?>
The problem is that the referrer.php is called but the image will not be displayed, which is obvious because the second rule is not reached.
I also have tried to display the image inside of the referrer.php, like:
<?
log_img($_REQUEST['uri'].' - "'.$_REQUEST['env'].'"');
$src = str_replace($_SERVER['DOCUMENT_ROOT'],'',$_REQUEST['ref']);
?>
<img src="<? echo $src ?>" />
But then the .htaccess is called again and I will run into endless loops.
The question is now: how can I access the second rule or how can I achieve what I want to do. Is there any way to do that?
Thanks for your help, Lars