Hi JPElectron,

You were looking good until you got to the code. You're trying to use
client-side code for your redirects, when you should be using server-side.
(If you cannot use server-side asp for any reason, try posting to a
client-side scripting group then. This one is all about server scripting.)
Keep your custom 404 page, but use code like this:

<%
Dim sScriptname, sRedirect
sScriptname = LCase(Request.ServerVariables("URL"))
Select Case True
Case Instr(sScriptname, "keytext1") > 0
sRedirect = "/page1.htm"
Case Instr(sScriptname, "keytext2") > 0
sRedirect = "/page2.htm"
Case Instr(sScriptname, "keytext3") > 0
sRedirect = "/page3.htm"
Case Else
sRedirect = "/page4.htm"
End Select

Response.Redirect sRedirect
%>


p.s. I assume that you do not want to also include the querystring or the
domain name. If you do, you can concatenate
request.servervariables("QUERY_STRING") and
request.servervariables("SERVER_NAME") to the sScriptname var.


Ray at home


--
Will trade ASP help for SQL Server help


"JPElectron" <JP_Electronhotmail.com> wrote in message
news:bfal8k$2ei$1nntp2-cm.news.eni.net...
> I'm trying to make a page (could be HTML, ASP, VBScript, JScript) that
> redirects to different pages based on text found within the URL.
>
> If the URL contains "keytext1" anywhere in it, then redirect to page1.htm
> If the URL contains "keytext2" anywhere in it, then redirect to page2.htm
> If the URL contains "keytext3" anywhere in it, then redirect to page3.htm
> If the URL doesn't contain any text matching what I was looking for then
> stay on the current page or redirect to page4.htm
>
> Please note, I am not looking to redirect based on text within the
referring
> doent URL, but based on text in the current page URL, I have a custom
404
> error doent setup so all URLS will go to this page. (the one with the
> code/script to do redirection)
>
> I was trying to build a page that did this (see below), but I admit I
don't
> exactly know what I'm doing.
>
> Below is what I had so far, I know "*keytext1*" isn't right, presumably
> because * or wildcard is invalid, but how can I do this without having to
> declair the absolute URL??
>
>
> <SCRIPT Language="JavaScript">
> <!--
> var keytext1pg = "page1.htm";
> var keytext2pg = "page2.htm";
> var keytext3pg = "page3.htm";
>
> function doit () {
> if (top.location == "*keytext1*") {
> top.location.href = keytext1pg
> }
> if (top.location == "*keytext2*") {
> top.location.href = keytext2pg
> }
> if (top.location == "*keytext3*") {
> top.location.href = keytext3pg
> }
> }
> //-->
> </SCRIPT>
>
>
> Also, can anyone tell me the difference in top.location and
> top.location.href Am I even close on the code above?
>
>