Skip to content
Link Redirect by Website URL in PHP

Link Redirect by Website URL in PHP

PHP Code Snippets > Link Redirect by Website URL in PHP

by Steve Dawson Web Developer


This is a variation on the affilite link mask script i wrote, this PHP link redirect script will allow you to redirect any url without giving away the referral page in the receiving websites logs. Thus allowing you to link to websites without giving away the forwarding page url.

So as an example, create a new file called link-go.php (this is just an example and can be called anything you want!) and paste the code below into this file.


<?php
// lets redirect to the website stored in the value of w
header ("Location: ".htmlspecialchars($_GET['w']).""); 
exit();
?>

Then all you need to do is to link to this file with the URL, so we would use the following to create a redirect link to google.co.uk:

http://www.your_domain_name.com/link-go.php?w=http://www.google.co.uk

Remember to change the part where it says 'your-domain-name to your actual domain name! You can change the website url after the .php?w= to the website you want to redirect / link to.


Free Quote available for any custom PHP and Database Software, Contact Steve Dawson Today