I want to make php script that will redirect any url passed to it..
I am running affiliate website and i am importing offers from api and those api give direct link and i want to hide it. so, i thought to create script and add prefix to all links to hide them then add not to index /go to google..
example go/goto.php?http://exampleurl.com/
Now url wont be same it could be any url so i want the script to goto exampleurl.com. so that i can prexix all url with goto.php?
is it possible to do so.. or any other recommendation..
your redirect.php:
<?php
$url = $_GET['url'];
header('Location: ' . $url);
when you navigate http://yourwebsite.com/redirect.php?url=http://www.google.com
should redirect you to google.
Try this code:
<?php
$link = $_SERVER['QUERY_STRING'];
header("Location: ".$link);
?><html>
<head>
<meta http-equiv="Refresh" content="0;URL=<?php echo $link; ?>">
<script type="text/javascript">
window.location='<?php echo $link; ?>';
</script>
</head>
<body bgcolor="white">
<p>Go to <a href="<?php echo $link; ?>">there</a> →</p>
</body>
</html>