private function add_referrer(Red_Item $item) { if ($item->match->url_from) { $lines[] = 'if ( $http_referer ~* ^' . $item->match->referrer . '$ ) {'; $lines[] = ' ' . $this->add_redirect($item->get_url(), $item->match->url_from, $this->get_redirect_code($item)); $lines[] = ' }'; } if ($item->match->url_notfrom) { $lines[] = 'if ( $http_referer !~* ^' . $item->match->referrer . '$ ) {'; $lines[] = ' ' . $this->add_redirect($item->get_url(), $item->match->url_notfrom, $this->get_redirect_code($item)); $lines[] = ' }'; } return implode("\n", $lines); }