Forum Moderators: phranque

Message Too Old, No Replies

Redirect Based On Refferer

Redirect Based On Refferer

         

Hard_Drive

12:00 pm on Dec 25, 2002 (gmt 0)

10+ Year Member



Hello,
First Message to this board... I have been reading up on some of the posts and there is some really great stuff in here.. so I signed up!

I used to have a redirect script that would redirect the user to a my main page if that user did not come from my main page..

it wasn't actually a script but a single line of code...
Now I am looking for it and all I can find is CGI and JavaScript.. I know the code I used to have was short and sweet... if anyone happens to have something like that laying around please post it here.

You'll make me a happy camper...

Merry Christmas!
Ho Ho Ho...

Quinn

10:52 pm on Dec 27, 2002 (gmt 0)

10+ Year Member



I this what you were looking for?

<meta HTTP-EQUIV="REFRESH" content="0"; url=http://www.yourdomain.com/index.html">

jdMorgan

11:37 pm on Dec 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hard_Drive,

Welcome to WebmasterWorld [webmasterworld.com]!

I can't help with the script, since I use a different method to redirect by referrer, but keep in mind that at least some of your visitors will - intentionally or unintentionally - not provide a referrer in the HTTP request. I suggest your redirect only for non-blank referrers which do not match your domain. Otherwise these visitors (and your server) will experience an endless redirect loop.

You may get a better response to your request by specifying what language script you want - JavaScript, PHP, PERL, etc.

Jim

Hard_Drive

5:51 pm on Dec 28, 2002 (gmt 0)

10+ Year Member



Quinn - Thank You!
But it was not a Meta Refresh..... =)

jdMorgan - I don't remember exactly what kind of script it was... I am assuming it was JavaScript..
It was a single line of code that basically redirected the surfer back to my main page if the surfer tried to access the content of my website without going through my main INDEX.HTML page... In other words MY INDEX.HTML page was the only referrer allowed..

No big deal I do not plan on using it now....
BUT it was in my bag of tricks... so I was looking for it again... =)

Thanks!

oilman

11:59 pm on Dec 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you could do it pretty handily with a small bit of php:

<?
if ($HTTP_REFERER= 'www.somedomain.com')
{
header ("Location: somepage.html");
}
?>

pretty sure that would do it