Here is an example of what I am trying to achieve!
If any of you skilled users could help me with this using php, I would be forever grateful!
It's pretty much a notice page to warn a user they are leaving the site!
My Answer:
You can achieve this by creating a PHP script that will redirect all external links to a splash screen. Here's an example of how you can do this:
1. Create a PHP file (e.g. redirect.php) and add the following code:
php
$url = $_GET['url'];
// Check if the URL is external
if (strpos($url, 'yourwebsite.com') === false) {
// Redirect to the splash screen
header('Location: splash_screen.php?url=' . $url);
exit;
} else {
// Redirect to the external URL
header('Location: ' . $url);
exit;
}
?>
2. Create a splash_screen.php file that will display the notice page to warn the user they are leaving the site.
3. Update your external links to point to the redirect.php file with the external URL as a parameter. For example:
html
External Link
When a user clicks on an external link, they will be redirected to the redirect.php file, which will check if the URL is external. If it is external, the user will be redirected to the splash screen page. If it is an internal link, the user will be redirected to the external URL.
Rate this post
3 of 5 based on 2838 votesComments