Note that there are some explanatory texts on larger screens.

plurals
  1. POSave HTTP_REFERER with mod_rewrite?
    primarykey
    data
    text
    <p>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):</p> <pre><code>RewriteCond %{REQUEST_URI} (.*)jpg$ RewriteCond %{ENV:verified} ^$ RewriteRule (.*)jpg$ /include/referrer.php?ref=%{REQUEST_FILENAME}&amp;uri=%{REQUEST_URI}&amp;query=%{QUERY_STRING}&amp;env=%{ENV:verified} [E=verified:yes] RewriteCond %{REQUEST_URI} (.*)jpg$ RewriteCond %{ENV:verified} ^yes$ RewriteRule ^(.*)$ %{REQUEST_FILENAME} [E=verified:no] </code></pre> <p>The referrer.php look like:</p> <pre><code>&lt;? log_img($_REQUEST['uri'].' - "'.$_REQUEST['env'].'"'); ?&gt; </code></pre> <p>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. </p> <p>I also have tried to display the image inside of the referrer.php, like:</p> <pre><code>&lt;? log_img($_REQUEST['uri'].' - "'.$_REQUEST['env'].'"'); $src = str_replace($_SERVER['DOCUMENT_ROOT'],'',$_REQUEST['ref']); ?&gt; &lt;img src="&lt;? echo $src ?&gt;" /&gt; </code></pre> <p>But then the .htaccess is called again and I will run into endless loops.</p> <p>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?</p> <p>Thanks for your help, Lars</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload