Website Redirector
Manage outbound traffic. This script reads the address bar to find a target destination and forwards the user, often used for link tracking or "exit pages."
Simulate a redirect link:
Click to Simulate: /redirect.php?target=example.com
Redirecting to example.com...
Copy the Script
<p>Redirecting you in 3 seconds...</p>
<script>
// 1. Get URL parameter
const params = new URLSearchParams(window.location.search);
const target = params.get('url');
// 2. Validate and Redirect
if (target) {
setTimeout(function() {
// Basic security: Ensure http/https
if(target.startsWith('http')) {
window.location.href = target;
}
}, 3000);
} else {
document.write("No target URL specified.");
}
</script>
Frequently Asked Questions
Yes, if used carelessly. Malicious users could use your domain to redirect victims to phishing sites. Always validate the target URL against a whitelist of allowed domains before redirecting.
It allows you to warn users they are leaving your site ('You are now visiting an external link...'), or to track outbound clicks in your analytics software.
Yes. This script uses `URLSearchParams` in pure JavaScript to read the URL, meaning it works on static HTML pages.