I need a script in PHP that’ll work like this:
redirect.php?url=http://example.com would redirect to example.com but I want it so I don’t have to manually add in every URL - I want it to redirect to the url in url=‘someurl’ so if my code was:
<?php
$url = $_REQUEST['url'];
//if ?url=http://google.com then redirect to http://google.com/
if ($url=="http://google.com/")
{
header( 'Location: http://www.google.com/' );
}
?>
If someone typed ?url=http://microsoft.com it wouldn’t work - I’d have to add it manually but I need something that’ll do this automatically (if redirect.php?url=http://example.com then redirect to http://example.com without me to have to add it manually). Please help if possible.