I have a simple php redirect script (link.php) that I use to keep track of our affiliate links. (Example: http://www.example.net/link.php?id=1 will bring you to http://www.product1url.com)
I've noticed that Google is indexing http://www.example.net/link.php?id=1. I have link.php set to noindex in Robots.txt but that's not stopping the indexing. So I want to add a "noindex", "nofollow" header to each URL itself.
Here's the script I have:
<?php
$path = array(
'1' => 'http://www.producturl1.com',
'2' => 'http://www.producturl2.com',
);
if (array_key_exists($_GET['id'], $path))
header('Location: ' . $path[$_GET['id']]);
?>
How do I modify this to include: "X-Robots-Tag: noindex, nofollow"? Is this possible?