Which redirect is recommended? I want to mask the link (example: AzoogleAds) and also keep some tracking info (not shown). Method 1, Header <?php $dest = $_REQUEST['dest']; header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header("Location: $dest"); ?> PHP: Method 2, Meta Refresh <?php $dest = $_REQUEST['dest']; if(!strlen($dest)) die('You fools!'); print <<<END <html> <head> <meta http-equiv="refresh" content="0;$dest"> </head> <body> <a href="$dest">Proceed manually »</a> </body> </html> END; ?> PHP: Method 3, Iframe <?php $dest = $_REQUEST['dest']; print <<<END <html> <head> <title>You are Here.</title> <style> body { margin: 0; } iframe { margin: 0; width: 100%; height:100%; border: 0; } </style> </head> <body> <iframe src="$dest"></iframe> </body> </html> END; ?> PHP: Method 4, Javascript window.location.href <?php $dest = $_REQUEST['dest']; print <<<END <html> <head> <script language = "javascript"> window.location.href='$dest'; </script> </head> </html> END; ?> PHP: Any other methods?
If you're masking the URL, I wouldn't use the 301 header as any automated scripts (like search engines) will go directly to the URL that's supposed to be masked after getting the 301.