As said above RewriteRules aren’t working for me so I used the following META tags, canonical URL (with a script) and robots.txt. The page will still be visible but Search Engines should ignore (most of) it:
Basic meta tags:
<!-- HIDE POPUP.PHP FROM SEARCH ENGINES -->
<meta name="robots" content="noindex, follow" /> <!-- Spiders will ignore this page but will crawl all other website pages -->
<meta name="robots" content="noarchive" /> <!-- Remove archived pages -->
<meta name="googlebot" content="nosnippet" /> <!-- Prevent Google from displaying snippets -->
canonical URL with script too shorten
http://www.abc.xx/popup.php?id=123&pid=12 to
http://www.abc.xx/index.php?id=123&pid=12
<?php
function selfURL() { //Get full URL
$s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s"
: "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2) { //Strip full URL
return substr($s1, 0, strpos($s1, $s2));
}
function cleanURL($url = '')
{ //Shorten full URL
$matchHTTP = substr($url, 0, 27);
$matchWWW = substr($url, 0, 20);
$matchHTTPS = substr($url, 0, 28);
if ($matchHTTP=='http://www.abc.xx/popup.php')
{
$url= 'http://www.abc.xx/index.php'.substr($url, 27);
}
elseif ($matchHTTPS=='https://www.abc.xx/popup.php')
{
$url= 'https://www.abc.xx/index.php'.substr($url, 28);
}
elseif ($matchWWW=='www.abc.xx/popup.php')
{
$url= 'http://www.abc.xx/index.php'.substr($url, 20);
}
else
{
$url = '';
}
return $url;
}
$fullURL = (selfURL());
?><link rel="canonical" href="<?php echo cleanURL($fullURL); ?>" />
robots.txt:
Note: the script above works well but should be improved before use! For me this was a not-so-quick-but-dirty solution