Forum Moderators: open

Message Too Old, No Replies

Redirect based on search string

How does it work?

         

Bobby

2:01 am on Mar 3, 2004 (gmt 0)

10+ Year Member



I have a script which redirects to another page based on who the referral comes from, but I need to modify it or write one which redirects to different pages based on search string.

Here is the original redirect script:

<!-- Begin
var refarray = new Array();
refarray['somedomain.com'] = "http://www.anotherdomain.com/index.htm";
for (var i in refarray) {
if (document.referrer.indexOf(i)!= -1) window.location.replace(refarray[i]);
}
// End -->

What I'd like to do is redirect to page1.htm for searches with "bobby" in the search string and redirect to page2.htm for searches with "billy".

Is there a simple way to do it which happens quickly and does not cause much of a delay?

isitreal

4:00 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you want an instant redirect you might think about using php, have the php redirecting code occur first thing on the page, the logic is pretty much the same, I assume you can do it with ASP too.