The Norwegian site www.webavisen.no (collection of RSS-feeds) uses redirection on all articles.
If you enter an article from www.webavisen.no you will be redirected to original source, but from Google (or typing URL directly in the address bar) you will not be redirected. How can this be done? With .htaccess or php? Is it legal?
Info from Google: site:webavisen.no -> 7 380 000 results.
I found the answer 
Structure:
nyheter/side1.php - with link
artikkel/side2.php - redirection
side3.php -with link
//Code ‘side1.php’
<a href=“…/artikkel/side2.php”>Side2</a>
//Code ‘side2.php’
<?php
$referer = $_SERVER[‘HTTP_REFERER’];
if (preg_match(“/nyheter/”,$referer)) {
header(‘Location: http://www.vg.no’);
}
?>
<html>
<head>
</head>
<body>
Side2
</body>
</html>
//Code ‘side3.php’
<a href=“artikkel/side2.php”>Side2</a>