Reputation: 23
Hello there i am running a daily deal website and i want to send my users to stores but currently my href is direct.
e.g - http://www.flipkart.com
and i want some php script so that i can make my url like this as i want to add affiliate script on "/go.php?url=(STORE URL)" -
e.g - http://www.mywebsite.com/go.php?url=http://www.flipkart.com
Please help me..
Upvotes: 1
Views: 309
Reputation: 11576
You can use any of the following techniques.
1. HTML Redirect.
Use code like this.
<meta http-equiv="refresh" content="0; url=<?php echo $_GET['url'] ?>" />
More details here
2. PHP redirect
<?php header("Location: $_GET['url']"); ?>
Make sure there should not be any space before this tag. this should be the first line
3. JavaScript Redirect
<html>
<head>
<script type="text/javascript">
function Redirect() {
window.location="<?php echo $_GET['url']; ?>";
}
setTimeout('Redirect()', 10);
</script>
</head>
<body>
</body>
</html>
Note: Even you can use combining all this three for must work (Fallback case if any).
Upvotes: 2
Reputation: 1439
perform a redirection at go.php
<?php
header("Location: $_GET['url']");
?>
If you want to give a warning to user that redirecting to this site by giving a refresh time and then redirecting try this.
Upvotes: 0