Hello, I am setting up a search engine and on the results page i have likes like this http://example.com/out.php?u={} how can i make it so http://ex.../ redirects to http://youtube.com/ Thanks,
what about if they goto the out.php file its a blank page how can i make it redirect to http://example.com/ thanks,
So... if they go to: http://example.com/out.php it will redirect them to http://example.com/ If they go to: http://example.com/out.php?u=http://www.google.com/ it will redirect them to google. <?php if (!isset($_GET['u'])) $_GET['u'] = 'http://example.com/'; header('Location: ' . $_GET['u']); ?> PHP:
Actually that's simple: <?php if (!isset($_GET['u']) || !filter_var($_GET['u'], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) $_GET['u'] = 'http://example.com/'; header('Location: ' . $_GET['u']); ?> PHP: