Click to See Complete Forum and Search --> : redirects from other site
DistantUK
02-22-2007, 05:29 PM
Hey, i was wondering is it possible, to redirect people to another site other than my own, if they use a link from a specific site?
Let me break down what i mean
Say i own www.me.com
People may come to my site,
But if someone clicks a link on for example a site I set it to (eg: www.you.com) i want them to redirected to google or some other site that isn't mine...
Is this possible, if its not PHP which it might not be, please forgive me...
But thanks in advance.
chesemonkyloma
02-22-2007, 05:57 PM
Why would that be PHP? PHP is for processing a page before it is even sent to the browser. But anyway, you can't do that if they are to ACTUALLY go to that website, you can fake the website with PHP, but otherwise it is impossible as far as I know.
vivekanandb
02-23-2007, 12:42 AM
You can use dynamic javascript to do such things.
Say you want to redirect user from your site to www.google.com then on clicking a link you can do this using PHP
<?php
echo '<script language="javascript">
window.location.href="http://www.google.com";
</script>';
?>
HTH
marketraiseint
02-23-2007, 12:53 AM
When you change your web site address or a file name on your site, you have to spread the word to visitors, other sites that link to yours, and search engines. Many webmasters use the META refresh tag to send visitors to the correct address until everyone's links are updated. But most don't know that innocent use of that tag may significantly lower your page rank or even get you banned in some search engines.
How It Works
The META refresh tag tells the browser to automatically request another page from the server after a certain number of seconds. This is also called "redirecting" because you're sending the visitor to a page other than they one they requested.
Redirecting works like this: when visitors click on a Web page that contains a META refresh tag inside the HEAD section, they're sent to a different page without actually clicking on a link. This is called page side redirection.
Best Regards,
shuvayu chakraborty
edit by admin: please do not post contact info to the forum, thank you
DistantUK
02-23-2007, 02:46 AM
THanks guys, but i knew how to redirect everyone.
However i only wish to redirect certain people, coming from a certain site from which they clicked the link to my site.
DistantUK
02-23-2007, 10:43 AM
bump :)
NightShift58
02-23-2007, 10:46 AM
<?php
IF ($_SERVER['HTTP_REFERER'] == "http://www.dontwantyou.com/nastypage.html") :
//redirect
header("Location: http://www.disney.com");
ENDIF;
//continue script...
?>
DistantUK
02-23-2007, 11:43 AM
i get an error saying it doesn't know what HTTP_REFERER means
NightShift58
02-23-2007, 02:04 PM
That's the first time I've run into that...
You can check here for more information: http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server
You could use $HTTP_SERVER_VARS['HTTP_REFERER'] in case your PHP version is pre-4.1.0. Other than that, it would be your server not supporting it.
DistantUK
02-23-2007, 04:39 PM
thank you
chesemonkyloma
02-23-2007, 05:43 PM
i was unclear of your question, sorry! i was going to tell you about using the referer but then i read that so nevermind...