Web Analytics Made Easy -
StatCounter Redirecting based on domain name, but not changing the address bar? - CodingForum

Announcement

Collapse
No announcement yet.

Redirecting based on domain name, but not changing the address bar?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirecting based on domain name, but not changing the address bar?

    Greetings,

    We have a couple different domain names pointing to our website and some of them go directly to certain folders.

    This is the script I use in my index.asp file to do this:

    PHP Code:
    <%
    dim serverName
    serverName 
    request.ServerVariables("SERVER_NAME")

    if 
    inStr(1,serverName,"xxx.com",1)>0 then
    response
    .redirect("http://www.xxx.com/home.asp")

    elseif 
    inStr(1,serverName,"yyy.com",1)>0 then
      response
    .redirect("http://www.xxx.com/abcd")

    elseif 
    inStr(1,serverName,"zzz.com",1)>0 then
      response
    .redirect("http://www.xxx.com/abcd")
    else
    %>

    <!-- 
    message for people who didn't enter either url goes here -->
    ERROR

    <%
    end if
    %> 
    This works fine except when someone types in one of the second or third domain names, they get redirect to the roper folder but their address bar changes to show that they are just in a sub folder of the main site. We'd rather have it keep the domain name that points into that folder. So if I type in www.yyy.com in my browser, ir redirects me to www.xxx.com/abcd but it also puts that in the address bar. I'd rather have it leave www.yyy.com in the address bat and redirect me behind the scenes to www.xxx.com/abcd.

    Then if I click a link to www.yyy.com/filename.htm it could just redirect it to www.xxx.com/abcd/filename.htm.

    Is that possible? If so, could someone point me to somewhere that would tell me how to do it that way instead?m I realize I can't do this in one ASP file since each link would have to point to that file, but is there a setting or something that could be done to make that whole domain just default to starting in a folder and going frmo there?

    Thanks.
    Last edited by kelemvor; Mar 9, 2004, 09:27 AM.

  • #2
    2 options I can think of:

    1: Server.transfer. It will basically redirect while leaving the url intact. I think if you leave that page though to click around and move around within the subfolder it will change the url. You could also just use an include statement or server.execute, but that won't leave the page in question, and will execute any code on the page below that spot.

    2. As bad as it may sound, you could use a frameset. The guy who originally did our internet site used frames. The address bar always stays the same, but in the content frame we're moving around between subdirectories.
    This is in spanish when you're not looking.

    Comment


    • #3
      Hmmm.

      Frames might actually work. This site is a really small site (maybe 12 pages) and each one has the same link bar across the top which could be turned into a frame. I'll have to give that some thought.... The actual main fram page could live in the root of the main web and it could just pull it's information from the subfolders and such..... hmmmm.

      Comment


      • #4
        That might be the most painless way, indeed. The pages within the frameset could be from anywhere at all....

        fv

        Comment

        Working...
        X