valid_referers problem

Todd HG lists at
Sun Oct 24 00:06:27 MSD 2010

I am using valid_referers to detect image hotlinking. Invalid referers
are forwarded to the homepage, however, I have since changed the address
for images from to

The last line contains the rewrite rule 'rewrite ^$request_uri? permanent;', which would
forward traffic going to to it's new
exact location at

What I'd like is for invalid traffic to be forwarded to the home page
located at, but for valid traffic to be forwarded
to the new url location for the image.

server {
    listen       9000;
    location /images {
      valid_referers blocked ~\.google\. ~\.yahoo\. ~\.bing\. ~\.ask\.
~\.live\. ~\\.;
        if ($invalid_referer) {
        rewrite  ^(.*)$;
    rewrite ^$request_uri? permanent;

Posted via

More information about the nginx mailing list