Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Location
    New Delhi, India
    Posts
    310

    website routing query

    hi there, i need a script for the following, or atleast a suggestion tho im not very good but can manage javascripts..

    I am hosting a website on a server, say abc.com, now i want to host another website say xyz.com (diff content) on the same server, i need a script that will understand which website url has been asked for by the user and route him to that particular path on the server. i.e - the index page should have some intelligent script which can do this redirecting business. any ideas?
    thx in advance
    Whence this creation has arisen - perhaps it formed itself, or perhaps it did not.The one who looks down on it in the highest heaven, only he knows or perhaps he knows not

  2. #2
    Join Date
    Apr 2002
    Posts
    5
    Hopefully you're using ASP (WindowsNT Server or higher and IIS).

    The following script (server-side) will return the value of the requesting URL Server:

    <%@ Language="vbscript"%>
    <%

    Request.ServerVariables("SERVER_NAME")

    %>

    So in ASP code you write the following script:

    <%@ Language="vbscript"%>
    <%
    Select Case Request.ServerVariables("SERVER_NAME")
    Case "www.whatever.com"
    Response.Redirect("wherever/whateverpage.asp")
    Case "www.whoever.com"
    Response.Redirect("wherever/whoeverpage.asp")
    Case Else
    Response.Redirect("somewhere/elsepage.asp")
    End Select
    %>

    Keep in mind that the case statement is CASE Sensitive (it's gotta match capitalization in order to return a match.)

    You can also use
    if ... then
    elseif... then
    end if

    ... and that is not CASE sensitive.

    You can find out more info on ASP at www.ASPfree.com and ServerVariables in particular by going to www.ASPfree.com/asp/servervariables.asp

    To iterate through the whole collection use this:

    <%@ Language="vbscript" %>
    <%

    For each V in Request.ServerVariables
    response.write V & ": " & Request.ServerVariables(V) & "<br>"
    Next

    %>

    Hope this works for you.
    Siege

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •